【发布时间】:2011-10-03 07:43:36
【问题描述】:
我已经通过如下程序在我的视图中创建了 tableview
table = [[UITableView alloc] initWithFrame:CGRectMake(0, 44, 320, 370) style:UITableViewCellStyleDefault];
table.delegate = self;
table.dataSource = self;
table.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:table];
在dealloc方法中我写如下
table.delegate = nil;
table.dataSource = nil;
[table release];
table=nil;
这是更好的方式或低于一个更好
[table release];
table=nil;
我想知道如果我不重置委托和数据源会发生什么
感谢
【问题讨论】:
-
可能重复:Should you set the delegate to nil in the class using the delegate or in the class itself 然后快速回答是,在您的 dealloc 语句中将委托设置为 nil 更安全。
-
@Sebastien:这不是那个问题的重复。
标签: iphone objective-c uitableview