Hi!
I need to duplicate a view, with all it's subviews.
Does anyone knows how to do it?
Thanks in advance!
Hi!
I need to duplicate a view, with all it's subviews.
Does anyone knows how to do it?
Thanks in advance!
The easiest (but probably not the fastest) way is to archive it into an NSData object and unarchive it right away.
NSData *tempArchive = [NSKeyedArchiver archivedDataWithRootObject:myView];
UIView *myViewDuplicate = [NSKeyedUnarchiver unarchiveObjectWithData:tempArchive];