我正在尝试从我的tableView重新加载数据。当从它自己的void中调用它时,它不工作,什么也不会发生。然而,当我删除一个单元格时,当我环顾四周时,它是有效的。我在想这和我的INIT有关。你能帮我解决吗?谢谢。
下面是我的代码!
- (id) init {
//NSLog(@"%@", theUserID);
// Set up database connection
NSString *myDBTwo = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"flashpics.db"];
databaseTwo = [[Sqlite alloc] init];
[databaseTwo open:myDBTwo];
//Initialize the array.
listOfItems = [[NSMutableArray alloc] init];
[listOfItems addObject:@"hi!"];
// Add to array to display in the tableView
NSArray *listOfItemsTwo = [databaseTwo executeQuery:@"SELECT * FROM albums"];
for (NSDictionary *rowone in listOfItemsTwo) {
NSString *getName = [rowone valueForKey:@"name"];
if (getName != NULL) {
[listOfItems addObject:getName];
[getName release];
}
}
//[database release];
return self;
}这是我的空白点:
- (void)refreshTableView {
[(UITableView *)self.view reloadData];
//[self.tableView reloadData];
}提前谢谢。
发布于 2011-03-08 10:46:10
您过度发布了getName,所以我认为这会崩溃。但是,如果在调用-refreshTableView时没有发生任何事情,那么我会认为self.view是nil。您应该验证以下内容:
在调用used
tableView:cellForRowAtIndexPath:时,refreshTableView实际上是calledself.view而不是nil,并在请求时返回正确配置的单元
https://stackoverflow.com/questions/5227703
复制相似问题