Questions tagged [initwithcoder]
49 questions
0
votes
2 answers
Saving custom objects to a plist with NSCoder
So, I've realised that I need to use NSCoding to save my custom objects to a plist.
The part I'm struggling with is exactly how I do that after I've implemented the initWithCoder and encodeWithCoder methods. They return id and void respectively, so…

Luke
- 9,512
- 15
- 82
- 146
0
votes
1 answer
initwithCoder and encodewithCoder on iOS
I have tried to save the state of a UIButton by using encodeWithCoder:
- (void)encodeWithCoder:(NSCoder *)encoder
{
[coder encodeObject:self.button1 forKey:@"button1"];
}
My initWithCoder: looks like this:
-(void)…

jason white
- 687
- 4
- 11
- 28
0
votes
1 answer
is it possible to convert a cpp model object to NSData
I am trying to pass a model object to a local server that i created. The model object is a cpp class. I need to convert it into data so that i could write it over the stream. When i tried to archive the class using Coder methods, gave me an error.…

Nibin V
- 474
- 6
- 24
0
votes
1 answer
drawLayer not called in initWithCoder?
I'm trying to copy a UIView with some properties. The UIView is overriding the drawLayer: method to draw custom shapes.
I'm using the NSKeyedArchiver, a pasteboard and NSKeyedUnarchiver to get back the properties. An instance of UIView is created…

Prathiba
- 287
- 2
- 4
- 15