0
- (void)viewDidLoad
{
[super viewDidLoad];
if (self.document.documentState == UIDocumentStateClosed){
[self.document openWithCompletionHandler:^(BOOL success) {
self.list = [[Categories getArrayForFirstTable:self.document.managedObjectContext] mutableCopy];
}];
}
[self.tableView reloadData];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.list count];
}
numberOfRowsInSection調用befor openWithCompletionHandler的塊。
[self.list count]爲零,爲什麼?numberOfRowsInSection之前調用openWithCompletionHandler塊
如果我想改變自我。清單,我應該放棄這個區塊嗎?有一些解決方案? – wmmj23
@ wmmj23請看我更新的回答 – liuyaodong
我是多麼愚蠢......非常感謝你〜 – wmmj23