Hi, how can I add a background image to UITextView?
Thanks.
Hi, how can I add a background image to UITextView?
Thanks.
Not sure about, but you can try the following, assuming that your background image is handled by a UIImageView:
[myTextView addSubview: myImageView];
Note that you may need to change the value of the alpha/opaque properties of your UITextView.
Kind Regards.
You can have a UIImageView containing the background image and the UITextView as siblings, then in Interface Builder move the text view to overlap the image view (or add them both to the same parent view if doing it programmatically). You also have to make sure the text view is not opaque and give it a 0% opacity background.
UITextView *textView = [[UITextView alloc]initWithFrame: window.frame];
textView.text = @"text\n text\n text";
UIImageView *imgView = [[UIImageView alloc]initWithFrame: textView.frame];
imgView.image = [UIImage imageNamed: @"myImage.jpg"];
[textView addSubview: imgView];
[textView sendSubviewToBack: imgView];
[window addSubview: textView];