uitableview多选

史上最简单得多选uitableview,只需一句话   

去年无意中发现,以为大家都知道得。。。。

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;
}


关于如何取得所选择的行,两个办法

1)通过delegate方法didselect和diddeselect来获取记录
2)通过运行时拿到UITableView的私有成员变量_selectedIndexPaths来获取

用第二种不会被封,但属于进阶用法,不建议新手使用。
posted @ 2011-08-31 15:11  KID  阅读(378)  评论(0编辑  收藏  举报