iphone Objective-C 附件和 setEditing 的有趣问题
在我的DetailViewController中,我有代码
UPDATED x2
这是我的setEditing
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[tableView setEditing:editing animated:YES]; //this line was added to force editing Mode
....
在我的detailViewController中,我想向tableView发送“魔法/无论它是什么”来注册“编辑模式”更改配件,但我不想调出删除按钮。以前我没有行 [tableView setEditing:editinganimated:YES];
,所以我只希望它显示附件。
In my DetailViewController i have the code
UPDATED x2
This is my setEditing
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[tableView setEditing:editing animated:YES]; //this line was added to force editing Mode
....
In my detailViewController I want to send tableView the 'magic/whatever it is' to register 'editing mode' to change the accessory, but I dont want to bring up the delete buttons. Previously I didnt have the line [tableView setEditing:editing animated:YES];
, and so I only want it to bring up the accessory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你绝对应该解决这个问题。
创建表视图单元格(在
tableView:cellForRowAtIndexPath:
中)时,将accessoryType
属性设置为UITableViewCellAccessoryNone
并将editingAccessoryType
设置为UITableViewCellAccessoryNone
和editingAccessoryType
code> 属性设置为UITableViewCellAccessoryDisclosureIndicator
。您可以执行此操作,而不是实现已弃用的
tableView:accessoryTypeForRowWithIndexPath:
方法。You should definitely fix this.
When you create the table view cell (in
tableView:cellForRowAtIndexPath:
), set theaccessoryType
property toUITableViewCellAccessoryNone
and theeditingAccessoryType
property toUITableViewCellAccessoryDisclosureIndicator
.You do this instead of implementing the deprecated
tableView:accessoryTypeForRowWithIndexPath:
method.