How to add UITextView as a subview to UIImageView on interface builder?
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 开发者_StackOverflowconfigure 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?
Create View and then put both of them inside of that.
View-->
|
--->imageView
|
--->textView
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.
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];
精彩评论