开发者

Make a copy of object

开发者 https://www.devze.com 2023-03-25 03:18 出处:网络
I have a UIScrollView on it I have UIImageView\'s and UIButton, when I create temp UIScrollView and try 开发者_JAVA技巧to do something like this:

I have a UIScrollView on it I have UIImageView's and UIButton, when I create temp UIScrollView and try 开发者_JAVA技巧to do something like this:

for (UIView *viewCopy in scrollView.subviews) 
{
       [tempScrollView addSubview:viewCopy];
}

Pointer of each subview on scrollView disappearing. I need make a copy of each object? How to make a copy of UIImageView and UIButton? Thanks..


UIImageView and UIButton, being derived from UIView, do not conform to the NSCopying protocol. So, you cannot make a copy.

You can instantiate multiple time UIImageView and UIButton and have as many objects as you need.

In any case, it is not clear what you mean by: "Pointer of each subview on scrollView disappearing"

0

精彩评论

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