我对 UITableView 和 setEditing 有以下问题。
视图第一次出现时,一切似乎都很完美。第二次崩溃上线:
[myList setEditing:YES animated:YES];
带有如下消息:
[1143:207] *** -[__NSArrayM count]: message sent to deallocated instance 0xb204700
在调试器控制台中。
我在这里包括两个相关的代码:
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
myList=[[UITableView alloc] initWithFrame:CGRectZero];
[myList addGestureRecognizer:swipeRecognizer];
myList.backgroundColor=[UIColor colorWithRed:0.82 green:0.82 blue:0.82 alpha:0.6];
myList.dataSource=self;
myList.delegate=self;
[myList setEditing:YES animated:YES];
………
}
- (void)viewDidDisappear:(BOOL)animated {
[myList removeGestureRecognizer:swipeRecognizer];
[myList removeFromSuperview];
[myList release];
myList=nil;
[super viewDidDisappear:animated];
}
由于这是我第一次使用 UITableView 和 setEditing,我可能会遗漏一些明显的东西。
任何人都可以在我的代码中看到可疑的东西吗?