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) initWithCoder:(NSCoder*)decoder
{
self.button1 = [coder decodeObjectForKey:@"button1"];
}
With button1
I save the state of the color, orientation, angle etc. And I can restore it with initwithCoder;
but when I tap the button it doesn't respond. The appearance has been restored but the IBAction
is no longer called.