I have the following problem with UITableView and setEditing.
The first time the view appears everything seems perfect. The second time it crashes on the line:
[myList setEditing:YES animated:YES];
with a message like:
[1143:207] *** -[__NSArrayM count]: message sent to deallocated instance 0xb204700
in the debugger console.
I include here the two relevant pieces of code:
- (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];
}
Since this is my first time to use UITableView and setEditing, I might be missing something obvious.
Anyone can see something suspicious in my code?