How to get multiple copies of a UIView loaded from a nib?

Posted by dmaestro12 on Stack Overflow See other posts from Stack Overflow or by dmaestro12
Published on 2010-05-07T14:53:53Z Indexed on 2010/05/07 14:58 UTC
Read the original article Hit count: 204

I want to use a UIView heirarchy multiple times (the nib object is a template). Unfortunately, UIView does not conform to <NSCopying> so

[cell.contentView addSubview: [[templEditCellView copy] autorelease]];

does not work.

I wasn't surprised, since I want a deep copy of the view heirarchy.

Currently the view is a top-level object in the nib it is loaded from. Is there a way to reload a single specified top-level object from the nib? Should I split out the view to a single NIB which can be reloaded on demand? Or is there another way to make a deep copy of a view?

Thanks!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk