ios - Xcode 6 UIImageView will not scale correctly -
please see screen shot of flower setup below. flower image has been correctly loaded asset catalog , when app run on various simulators right pixel resolution assigned each device. problem how flower image scaled (equally sized fit) same on each device ?? have learnt how position image different positions using constraints , frames image never scales correctly - please see first pic
the next image mock of want able (flower image scaled correctly on each device)
judging mockups, looks want image fill half width, , maintain square aspect ratio determine height. 1 way approach utilize autolayout create left uiimageview , right placeholder (blank) view. pin left view left border of parent, right view right edge, , set them 0 pixels each other. set equal widths constraint on them. finally, command drag image view , can select aspect ratio -- , assuming in ib, width , height same, maintain square. adding equal heights constraint give other view height needs equal in case need that.
this gives left image view 50% , mode set aspect fit or aspect fill, should give results in mockups. in case have image isn't square, create sure check clip subviews uiimageview prevent showing overflow.
ios iphone xcode ipad xcode6
No comments:
Post a Comment