iOS 10 设置TableViewCell侧滑时,当Cell上有按钮的点击事件,当Cell进入编辑状态的时候取消按钮的点击事件


//定义编辑样式

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = NO;

    return UITableViewCellEditingStyleDelete;

}

 

 

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath{

    MyLog(@"开始进入编辑状态");

    

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = NO;

    

}

- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(nullable NSIndexPath *)indexPath{

    MyLog(@"结束编辑状态")

    JKDZMTGoodBaseCell * cell = (JKDZMTGoodBaseCell *)[tableView cellForRowAtIndexPath:indexPath];

    cell.coverImg.enabled = YES;

}

 

//修改编辑按钮文字

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {

    return @"删除";

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM