Car*_*los 1 iphone uitableview swipe ios ios6
对于UIViewController重用目的,我想仅在满足条件的情况下允许"滑动删除"手势.有没有办法实现这一目标?
如果我添加以下UITableViewController委托方法:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
Run Code Online (Sandbox Code Playgroud)
"滑动删除"已启用,但我无法区分我要禁用此手势的情况
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL someCondition = // figure out whether you want swipe to be available
return (someCondition) ?
UITableViewCellEditingStyleDelete : UITableViewCellEditingStyleNone;
}
Run Code Online (Sandbox Code Playgroud)
来自本书这一部分的结尾:
http://www.apeth.com/iOSBook/ch21.html#_deleting_table_items
| 归档时间: |
|
| 查看次数: |
2407 次 |
| 最近记录: |