How can I make a custom view of the 'delete-button' when performing commitEditingStyle within a UITableView

后端 未结 4 880
囚心锁ツ
囚心锁ツ 2021-01-03 13:20

I would like to customize the delete button which is shown when performing the \'swipe to left\'-action on a tableview cell. I currently set up a subclass of a UITableViewCe

4条回答
  •  隐瞒了意图╮
    2021-01-03 14:09

    -(void)willTransitionToState:(UITableViewCellStateMask)state{
        NSLog(@"EventTableCell willTransitionToState");
        [super willTransitionToState:state];
        if((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
        {
            UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake( 320,0, 228, 66)];
            [deleteBtn setImage:[UIImage imageNamed:@"BtnDeleteRow.png"]];
            [[self.subviews objectAtIndex:0] addSubview:deleteBtn];
            [self recurseAndReplaceSubViewIfDeleteConfirmationControl:self.subviews];
            [self performSelector:@selector(recurseAndReplaceSubViewIfDeleteConfirmationControl:) withObject:self.subviews afterDelay:0];
        }
    }
    

提交回复
热议问题