Wednesday, 15 May 2013

cocoa touch - iOS: How to align (left/right) a UIImageView when using UIViewContentModeScaleAspectFill? -



cocoa touch - iOS: How to align (left/right) a UIImageView when using UIViewContentModeScaleAspectFill? -

i'm playing contentmode property of uiimageview.

when set uiviewcontentmodescaleaspectfill, image scaled fit screen. it's centered. right , left (or top , bottom, depending on screen orientation) part of image clipped.

i'd have same behaviour not centered. possible have image clipped on right (or left) side? (again top or bottom depending on orientation) ?

thanks

i know it's been while since february, encountered same need in app developing.

i solved using custom uiimageview can integrated existing code (it's drop-in replacement of uiimageview).

you can find class on github, along example: https://github.com/reydanro/uiimageviewaligned

hope helps on next projects

ios cocoa-touch uiimageview contentmode

No comments:

Post a Comment