Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode - Image editing

I'm developing an image editing application on the iPad. It is like a function where you can write text into an image and then save it.

The user will be able to select an image from the iPad's photo gallery. When a photo is selected, it will navigate to another view showing an ImageView, TextField, 'Test' button and 'Confirm' button.

  • The ImageView will display the selected photo.
  • The TextField enables the user to enter some text.
  • When the Test Button is tapped, the text entered will appear on the image.
  • When the Confirm Button is tapped, the image (with the text on it) will be saved.

I know how to code the part that allows the user to select an image from the photo gallery and navigating to another view showing the selected image on the ImageView.

So i need help on how to display the text on the image and saving the image (with the text on it).

like image 494
Lloydworth Avatar asked May 23 '26 19:05

Lloydworth


1 Answers

There are a couple of ways. The easiest it so just take a snapshot of the super view using this code.

CGRect rect = CGRectMake(<your values>);
UIGraphicsBeginImageContext(rect.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

This is a duplicate of How to convert UIView as UIImage?.

like image 55
logancautrell Avatar answered May 25 '26 07:05

logancautrell