aqa*_*cha 1 iphone uitableview uibarbuttonitem
嗨,我在iphone中编辑表格视图.我使用在viewDidLoad()方法下编写的以下代码执行此操作.
UIBarButtonItem* barBtnItemEdit = self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self
action:@selector(turnOnEditing)];
Run Code Online (Sandbox Code Playgroud)
我的表视图正确地进入编辑模式,但它向右滑动了一点.现在我想做的是锁定表,使其即使在编辑模式下也保持在其位置.我在编辑模式下编写表的自定义代码,而不是默认删除或插入行为..
我已经实现了以下代码来停止在每行前面显示"红色删除"按钮......
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}
Run Code Online (Sandbox Code Playgroud)
但是UITableVIew仍然向右滑动一点.现在如何锁定表,以便它不会在编辑模式下更改其位置
最好的问候,阿卜杜勒卡维
我想你还需要补充:
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
630 次 |
最近记录: |