Я предлагаю вам создать подкласс UITableViewCell и добавить кнопки в качестве свойств, а затем установить для их свойства hidden
значение YES:
@interface CustomCell: UITableViewCell
{
UIButton *btn1;
UIButton *btn2;
}
@property (nonatomic, readonly) UIButon *btn1;
@property (nonatomic, readonly) UIButon *btn2;
- (void)showButtons;
- (void)hideButtons;
@end
@implementation CustomCell
@synthesize btn1, btn2;
- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStrig *)reuseId
{
if ((self = [super initWithStyle:style reuseidentifier:reuseId]))
{
btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// etc. etc.
}
return self;
}
- (void) hideButtons
{
self.btn1.hidden = YES;
self.btn2.hidden = YES;
}
- (void) showButtons
{
self.btn1.hidden = NO;
self.btn2.hidden = NO;
}
@end
А в вашем UITableViewDelegate:
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
[(CustomCell *)[tableView cellForRowAtIndexPath:indexPath] hideButtons];
}
- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
[(CustomCell *)[tableView cellForRowAtIndexPath:indexPath] showButtons];
}
Hopeэто помогает.