2012-10-06 38 views
0

enter image description here如何讓UITableViewCells默認情況下,編輯

選擇在上面的截圖中我已經手動選擇的細胞通過點擊他們,但我要爲默認的編輯被選中所有單元格。

+0

cell.accessoryType = UITableViewCellAccessoryCheckmark; 使用它或給你的代碼:) :) – 2012-10-06 10:14:44

+0

試試這個cell.selected = YES;在cellForRowAtIndex:方法中 –

回答

3

您可以使用此代碼....

for(int i=0; i<[array count]; i++) 
{ 
    NSIndexPath *indexP = [NSIndexPath indexPathForRow:i inSection:0]; 
     [tblView selectRowAtIndexPath:indexP animated:NO scrollPosition:UITableViewScrollPositionNone]; 
    [self tableView:tblView didSelectRowAtIndexPath:indexP]; 
} 

哪裏tblView是你tableView

相關問題