views:

27

answers:

1

I have a NSMutableArray of some instances of a custom class (it has a NSString, CGPoint, and a UILabel).

I need to save this array. I tried using writeToFile:Atomically: but that doesn't work with custom classes (I think). Is there any other simple way to save that? And how would i load it?

Thanks everybody in advance:) Any ideas, suggestions, pointers

A: 

You can use NSCoding to help with this, but I think you'll find it tricky to deal with the semantics of saving and restoring UILabels. Would it not be possible just to store them in a nib file?

David
`UILabel` conforms to `NSCoding`, so it should be fine (as long as it's not a custom sublcass).
eman
Yes, but he'll have to make sure it gets properly connected back up to its superviews when it's loaded back in. Certainly possible, but I'm not sure what application would call for it (except where a nib-file would do it better).
David