I have got an image 300px300px, but i only want to show 100x100 of it, just like here https://www.pinterest.com/pin/31103053652400980/ background photo is only showing part of it.How can i do that?
You can use UIImageView that has property Clip To Bounds on. After that you can change Content Mode of the `UIImageView' that suits you.
Example:
Related
I want to show a bellow image using UIImageView.
is it possible to show by UIImageView or any other way we can show it.
Please help me.
You need following type of design from your designer :
In above image. White part inside the red box will be transparent. And then you can set this image to UIImageView
I am working on module where I need to perform following activities.
Select image from Library.
Show that image.
Zoom that image.
Save the Zoomed portion or visible portion on the view.so that final image will get saved with zoomed.
I have covered 1,2,3 and struggling with 4
Does anyone have idea about this?
Thanks,
Sagar
If I understand you correctly, you want to save image that appears on the screen after zooming? To do that you can use CGImageCreateWithImageInRect function.
I have numerous photos in portrait and landscape format. I want to be able to display a "crop" of the photo in a UIImageView on the iphone. If the picture is in landscape format I want it to resize to fit the frame, if it is in portrait format I need it to resize to fit the width, and then be cropped at the top and bottom. As if there is a "window" over the image - so it looks like a landscape picture.
It would be even better if this could be a UIButton - although I am aware that I can use touchesBegan and such on images to make it behave like a button if needs be.
Thanks for any help you can give me.
Thanks
Tom
In an ImageView, you can change the View Mode to Aspect Fill. It will give you the right scaling/cropping you want.
For interactions, you can use a Custom button with no drawing at all (no Title, no Image, no Background) with the same size as your ImageView. That would be safe with regards to the image aspect. I've tried similar stuff using the button's Background or Image properties, it can have some undesired effects (I've ran into a resizing issue on iOS 3.1.3 for instance).
1°) To Crop the Image, try to add a method to UIImage class to do it (you can google it without problem, or even on StackOverFlow)
2°) To add a "window" over your image, just add an UIImageView over your image wich has transparency. It should work ;-)
3°) To know when an image is touched, you can use "touchesBegan" to detect which image were selected. But I think it's the last of your problems ^^
What you cant to achieve isn't so hard, just to it step by step !
If you want more help in one step, say it. But I can't code it all for you ;-)
Good Luck
I need your help to know how to create an iPhone application to show a photo with SCRATCH OUT EFFECT.
Something like the effect in this flash tutorial
http://www.tutorial5.com/content/view/115/46/
Please help.
Thanks.
You can have a look at the following post on how to create a blurred image effect, I don't think it's the best & fasted method, but it might get you started:
UIImage blur
You can implement the scratch out effect by using CoreGraphics.
Subclass UIView for the scratchable image.
Draw the scratchable image, use a mask to cut out the parts of the image that gets "scratched".
Each time the user scratches the image, make it so the mask and the image gets updated.
Full code example on github
I wanted to change the resolution of a image,this image I am getting from remote location.The image I am getting is too large to fit in iPhone screen is their any way to change that resolution?
If you're using a UIImageView then UIView's contentMode is what you need, you should probably set it to UIViewContentModeScaleAspectFit (or the equivalent in Interface Builder).
Assuming you are using some kind of "View" to display the image (rather than custom drawing) you might see if there is some kind of property which would allow you to set the "Mode" of the view to allow various scaling methods.
If you render it, it should scale anyway (see UIImage::drawInRect) However, CGContextDrawImage will scale draw an image into a new context, which you can then use to render to the screen.
If you're looking to actually resize a UIImage to smaller dimensions, this blog post might help.