I am trying to archive, unarchive objects using NSKeyedArchiver, NSKeyedUnarchiver, NSCoding (initWithCoder, encodeWithCoder methods) in order to access the last view before the application was terminated.
This works with OS 3.0 and above, but for OS 2.2.1, the objects are unarchived but a blank screen is displayed on application relaunch.
This is how I have been trying to initialize my view:
- (id)initWithCoder:(NSCoder *)decoder{
self = [super init];
if (self != nil)
{
开发者_如何学Python //my code
}
return self;
}
I also tried using initWithNibName method as follows
- (id)initWithCoder:(NSCoder *)decoder{
self = [super initWithNibName:@"myView" bundle:nil];
if (self != nil)
{
//my code
}
return self;
}
But a black screen is displayed.
Can anyone please help?
Actually, you should call
self = [super initWithCoder:decoder];
精彩评论