|
如何让他选中的时候多出一个按钮
|
|
![]() 80分 |
选中后,再调用 didSelectRowAtIndexPath 在这个位置来控制这个按钮的显示与隐藏
- (void)selectFirstRow
{
if ([self.tableView numberOfSections] > 0 && [self.tableView numberOfRowsInSection:0] > 0) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionTop];
[self tableView:self.tableView didSelectRowAtIndexPath:indexPath];
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
/////这个button要在设计cell时就已经添加,只是未选中状态不可见而已。现在设置成可见状态
cell.flagButton.hidden = NO;
}
|

