我在那裏我閱讀dispatch_async內的UITableView的自定義單元格的子視圖的內容(的情況下),如下:Dispatch_async停止的UITableView重裝
dispatch_async(myQueue,^{
[self filterArrays];
[self updateSlotData];
});
的updateSlotData內:我想訪問的UITableViewCell的子視圖如下:
for (int i = 1 ; i <= [slotTable numberOfRowsInSection:0]; i++) {
SlotDataCell *cell = (SlotDataCell *)[slotTable cellForRowAtIndexPath:[NSIndexPath indexPathForItem:i-1 inSection:0]];
NSLog(@"iterating inside %i %i %i",[cell.intTF.text length],[cell.toTF.text length],[cell.fromTF.text length]);
if(![cell.intTF.text length] || ![cell.toTF.text length] || ![cell.fromTF.text length]){
outdatedTF = [NSString stringWithFormat:@"Slot %i timing",i];
newSlot = false;
return NO;
}
}
在調用重裝數據: isDBSelected = FALSE; addMode = false; [slotTable reloadData];
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if(tableView == slotTable){
if(isDBSelected){
if(addMode){
return [countArray count] + 1;
}else{
return [countArray count];
}
}else{
NSLog(@"new template creation started");
return 1;
}
}
return 0;
}
該表重新加載,第一行被初始化爲零。其他行似乎不會消失。預期結果:只創建一行。
任何UI更新都必須位於主線程上。 – Kreiri 2013-05-07 08:58:21
@Kreiri如果UI更新發生在後臺線程意味着什麼,會發生什麼? – Mani 2013-05-07 09:04:38
該線程的EXC_BAD_ACCESS – DesperateLearner 2013-05-07 09:08:15