UITableView编辑模式 [英] UITableView Edit mode

查看:127
本文介绍了UITableView编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UITableView ,我试图在编辑模式下默认加载它。问题是当我这行 table.editing = TRUE; 我的行消失了,我实现了这个方法:

I have UITableView and I am trying to load it by default in edit mode. The problem is when I this line table.editing=TRUE; my rows disappear, I implemented this methods:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 
{
// Return NO if you do not want the specified item to be editable.
return YES;
}

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


 - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath 
 {
 return NO;
 }

但没有运气。我该怎么办?

but with no luck. What should I do?

推荐答案

Anish 指向使用

as Anish pointed to using

[tableView setEditing: YES animated: YES]; 

但你需要在中查看它ViewWillAppear 查看事件以使其工作。

But you need to have it in viewWillAppear view event to make it work.

这篇关于UITableView编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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