2010-12-13 198 views

回答

1

您需要在您的barbutton聲明中已給出的方法設置單元格的附件類型。

檢查此代碼。跟着那樣

UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(showChecked)]; 

- (void)showChecked{ 
isChecked = YES; 
[tableView reloadData]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 


cell.accessoryType = UITableViewCellAccessoryCheckmark; 

return cell; 
} 
0

使用一個布爾變量isButtonClick;

並在barButton上附加一個動作click click click;

所以在點擊

-(void)click 
{ 
    isButtonClick=YES; 
    [yourTable reloadData]; 
} 

現在的cellForRowAtIndexPath

放條件

{ 
    //your code 

    if(isButtonClick) 
    { 
    [yourTable setAccessoryType:UITableViewCellAccessoryCheckmark]; 
    } 

} 
相關問題