i have picture like this image it will present on Landscape Mode
so if rotate device to Portrait, how to present image like this
i have picture like this image it will present on Landscape Mode
so if rotate device to Portrait, how to present image like this
Use an UIImageView with these settings:
You will have to work with view's layer.
You can find the appropriate guidelines at https://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Layers.html
Hope this helps.
Thanks,
Jim.
It looks like what you're trying to do is clip the image on the right, while leaving the top, left, and bottom the same.
Two things to try:
1) Subclass UIView and in the
drawRect
method, adjust the rect and draw out the clipped image usingCGContextDrawImage (context, rect, sourceImage.CGImage)
.2) Use CALayers. You can adjust the 'contentsRect' of the imageView's layer:
This slices the image in half along width.
masksToBounds
takes care of clipping sublayers (in case you have them). You can tweak thecontentsRect
unit rectangle to adjust where you want the cutoff. You may also want to adjust the imageView's own bounds as well to match the size.This has an added bonus in that adjusting the contentsRect is automatically animated so when you do the rotation the width animates in and out nicely.