I have created a UIImageView
and I want to add a UITextView
as a subview beneath the image. Is there any way that I can configure this using the Interface Builder instead of hardcoding it? If not, in which part of the code should I insert the subview to and what else do I need to change?
Asked
Active
Viewed 3,123 times
2
-
I'm not sure I understand. You want this label to be a subview of image view or you want it to always stick under image view no matter how tall this image is or what? – Filip Radelic Aug 06 '11 at 11:19
-
Possible duplicate with additional info: http://stackoverflow.com/a/2956734/1804403 – drvdijk Jul 31 '13 at 01:28
3 Answers
3
Create View and then put both of them inside of that.
View-->
|
--->imageView
|
--->textView

Vijay-Apple-Dev.blogspot.com
- 25,682
- 7
- 67
- 76
-
It would be nice if Interface Builder allowed this, but it does appear that your are forced to create just a regular UIView container for both the image and the text view. However, you may not need to create a new container view, since it might turn out that you already have a single master view. In that case, just drag the UITextView over the UIImageView. – Skotch Jul 31 '13 at 01:23
0
You should just be able to do:
[myImageView insertSubview:myTextView atIndex:0];
If you want it actually to be "part of" the UIImageView I don't think you can do it in Interface Builder. But this is a normal method of extending UIKit views.

arsenius
- 12,090
- 7
- 58
- 76
0
Yes you can do it in Interface Builder - see the image
To get this view, at the bottom there is an <
arrow image. Click to get this. After that its drag your UI element underneath any other element to add that element as a subview
of that UI element...
Of course you can do this in code by simply writing [someView addSubView:newView];

Srikar Appalaraju
- 71,928
- 54
- 216
- 264