[英]How can I highlight the BarButton in navigation bar without tapping it?
[英]Can i set the UITableViewCellAccessoryCheckmark on BarButton?
我想在触摸Bar按钮时UITableViewCellAccessoryCheckmark tableView的所有单元格吗?
您需要使用在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;
}
使用布尔变量isButtonClick;
然后在barButton上附加一个动作。
所以在点击
-(void)click
{
isButtonClick=YES;
[yourTable reloadData];
}
现在在cellforRowAtIndexPath中
放置条件
{
//your code
if(isButtonClick)
{
[yourTable setAccessoryType:UITableViewCellAccessoryCheckmark];
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.