Add a text to an UIImage - ios

I have an UIImage I want to allow the user to circle a particular part of the image and then write something about it on the image and then I want to save this image.
I do not know how to start on this are there any libraries or example that can help

First take one UIImageView add your image in it. Now add label as subview in UIImageView.
Now finally capture the the UIView as image.
Here this will help you to code for capture the UIView as image
Thanks.
Capture UIView and Save as Image

Related

add ImageView at the background of UIScrollView

i am trying to create a mechanism for changing user's profile image same as whatsapp does , here's how it looks :
this is what i want to achieve
and this is what i have :
in the second image the background of scrollView is in purple colour i want to add here a UIImageView + UIEffectView as shown in the first image which will be immovable (fixed at position ) but i dont know where to start if anybody knows how am gonna do this than please let me know it'll be so helpful for me. thanks

Aspect Fill an image (the image will be updated by the user) in a Custom circular UIButton

I have a problem in one of my iOS app projects.
My question is: What is the most efficient way to create a circular UIButton with a specific size that will have an Aspect Fill UIImage, that the user can update anytime from the camera or library?
I'm trying to create a circular UIButton that will have the image that the user uploads. One solution I've tried is to make the image circular and then overlay it with just an empty button, but it doesn't feel too efficient.
I want to use these buttons in a UITableView, so basically more than one of these buttons.
I hope I can get an idea (not necessarily an example code, but more like a logic to make it more efficient and simple) of how to approach this problem with the UIButton so that the image will be updated and Aspect Filled within the properties of the button.
I too prefer the UIImageView with UITapGesture. Because by my experience the aspect ratio did not work well in UIButton. UIImageView with layer.cornerRadius with fine to execute from User Interation Side.
you can just add a UIButton in your UITableView and set/change backgroundimage of it with the UIButton click event.
turn the button into a circle.your can user code like this:
[btn.layer setMasksToBounds:YES];
[btn.layer setCornerRadius:10.0];
or if you use xib,you can do like this:
http://i.stack.imgur.com/Ytlqs.jpg

background image for CGContext

Question: How do I display a background image underneath a CGContext?
I have created a view controller using the storyboard and placed a view with a full-screen background image. Then, using the same view controller, I created a outlet to a UIView that has a CGContext where I draw a few lines.
Everything works except that the drawing takes place underneath the background image. (Suddenly I wonder if it's not the CGContext but the UIView that is the problem.)
I found a similar question here, but the solution makes it sound like the background image has to be constantly refreshed using CGContextDrawImage with a CGImageRef. Which may be true, but a static image being constantly refreshed doesn't sound like a very elegant solution. Thank you!
Create custom UIImageView subclass where you will draw your custom background.
Better to subclass UIImageView instead of UIView, because in this case you don't get problems with adding other views above this in Interface Builder.
Add UIImageView to your view controller, and change class to your custom class. Add all other views above.
Question: How do I display a background image underneath a CGContext?
Answer: Set the color of the view with the CGContext to Clear Color.
That way the background image is visible as well as the lines that are subsequently drawn. Guess I kind of overcomplicated that one.
Thank you for the response Vitaliy.

Image not displayed with clarity

I am using auto layout and working with custom UITableViewCell. Inside this cell, I want tp display an image. Issue is that image is not displayed with clarity.
Actual image is this :
But in app, it is displayed as below :
What can be the reason? How to solve it?
![enter image description here][3]
To maintain corner radius for changes in image dimensions, use the resizableImageWithCapInsets method on UIImage.
Good tutorials:
http://useyourloaf.com/blog/2012/07/05/customizing-appearance-with-resizable-images.html
http://ios.biomsoft.com/2011/12/20/ios-5-uiimage-and-resizableimagewithcapinsets/

Draw a line when user touch the Uiimageview

i am working on a project in which i have added a UIimageview to show an image selected by user. Now requirement is that if user want to crop an images it can touch the image according to crop requirement. when user cropping the image a line should draw at place where user has touched. i know that UITouch class will use for it. But i am unable to do it.
A couple of possible solutions.
1) Create a custom UIView that contains a UIImageView as it's subview. Make the UIImageView be the same size as the custom UIView. Then add code to detect the touches on the custom UIView and draw the lines on top of the UIImageView subview.
2) Create a custom clone of UIImageView that draws the image first as the 'background' and then detects the touches and draws the lines on top of the image.
Also make sure you have userInteractionEabled set to YES on the view receiving the touches.

Resources