I have a NSString object. I want to write it to existing UIImage object. UIImage object already has some image associate with it. I want to write string to same image. How do i
An NSString
cannot become a UIImage
. However, it sounds like all you want to do is plunk some text on top of an image, and that can be achieved easily.
Create a UILabel *label
. Set the text to your string with label.text = myString;
.
Create a UIImageView *imageView
. Set the image of the view to your image with imageView.image = myimage
.
Add the UILabel
as a subview of the UIImageView
(as a subclass of UIView
, it takes subviews) with [imageView addSubview:label];
(or drop the label on the imageview if you're using the IB).
Make sure to set the background of the label to [UIColor clearColor]
or set the alpha = 0.0
so that it's transparent.