DNB*_*ims 5 iphone objective-c uitableview
我在表上添加了一个editButton,如下所示:
self.navigationItem.leftBarButtonItem = self.editButtonItem;
Run Code Online (Sandbox Code Playgroud)
并且,有一个setEditing方法:
- (void) setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.watchListDetailTableView setEditing:editing animated:animated];
if (editing) {
// you might disable other widgets here... (optional)
} else {
// re-enable disabled widgets (optional)
}
}
Run Code Online (Sandbox Code Playgroud)
单击编辑后,我可以有一个交叉和删除按钮,我应该采取哪种方法来处理删除按钮单击?谢谢.
这应该是:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
Run Code Online (Sandbox Code Playgroud)
当用户点击插入(绿色加)控制或删除与在表格视图一个UITableViewCell对象相关的按钮,表视图将此消息发送到数据源,要求它提交更改.(如果用户点缺失(红色负)控制,表视图然后显示删除按钮来获得确认.)中的数据源通过调用的UITableView方法insertRowsAtIndexPaths提交该插入或缺失:withRowAnimation:或deleteRowsAtIndexPaths:withRowAnimation :,如适当.
归档时间: |
|
查看次数: |
3180 次 |
最近记录: |