开发者

How can I copy live UIView's into a new UIView?

I have 6 UIView's (UILabel's and UIImageView's) laid out in a NIB for display during regular app use. The contents of the labels and the image views change dynamically during use.

At开发者_运维知识库 a certain point in app functioning, I want to take those views -- with the contents they have at that moment -- and put them into a new UIView, where I can slightly rearrange them and change the text in one of the UILabel's. So I don't want pointers to the original UIView's -- I want copies that I can play with. How can I get them?

Purpose here is to create an overlayView for when the user takes a picture.

Thanks!


I didn't find a programmatic way to do this. Instead, I created a new UIView in my NIB (pretty much copying, pasting, and rearranging the UILabel's and UIImageView's I needed) and hooked up new IBOutlets for the UIView and all its subviews. Then when I need to display the camera overlay, I set the contents of the UILabel's and UIImageView's to match the contents of the source views. It actually works very well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜