开发者

Archive/ unarchive objects in iPhone OS 3.0 & 2.2.1

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜