单击自定义UIButton删除UITableView行 [英] Delete a UITableView row by click on custom UIButton

查看:183
本文介绍了单击自定义UIButton删除UITableView行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想删除作为该行一部分的按钮的click事件的行。

我不能使用提交编辑样式,因为我想用相同的按钮执行取消订阅和删除。

Basically I want to delete row on click event of a button which is a part of that row.
I can not use commit editing style because i want to perform unsubscribe and delete with same button.

点击订阅按钮我要删除该特定行。

所以任何想法,我该怎么办。

On click on subscribe button i want to delete that particular row.
so any idea, how can i do it.

推荐答案

它适用于以下代码

按钮点击事件

    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.table];
    NSIndexPath *indexPath = [self.table indexPathForRowAtPoint:buttonPosition];
    [self.arraylist removeObjectAtIndex:indexPath.row];
    [self.table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

这篇关于单击自定义UIButton删除UITableView行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆