开发者

How to add UITextView as a subview to UIImageView on interface builder?

开发者 https://www.devze.com 2023-03-26 03:23 出处:网络
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 hardco

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

How to add UITextView as a subview to UIImageView on interface builder?

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];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号