Unarchiving UIImageView with subviews

为君一笑 提交于 2019-12-01 23:26:15

[Previous answer deleted.]

EDIT: Hmm. I just tried this:

- (IBAction)doButton1:(id)sender {
    theData = [NSKeyedArchiver archivedDataWithRootObject:iv];
    [iv removeFromSuperview];
    iv = nil;
}

- (IBAction)doButton2:(id)sender {
    iv = [NSKeyedUnarchiver unarchiveObjectWithData:theData];
    [self.view addSubview:iv];
}

It worked - with an ordinary UIImageView. So now I guess I don't understand what you're getting at; it appears that a UIImageView is already archived with its image. So you must be trying to solve some other problem. But I'm not grasping what the problem is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!