2010-12-13 237 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]; 
    } 

} 
相关问题