ios构造和析构

遵循规则:

构造先父类后子类

析构先子类后父类

所以,自定义的init函数需要首先[super init....] dealloc中[super dealloc]却是放在最后的

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc {
    [textEntered release];
    [super dealloc];
}

posted @ 2013-09-10 16:58  如来藏  阅读(194)  评论(0编辑  收藏  举报