简体   繁体   English

在UITableViewController中更改红色的编辑按钮附件视图

[英]Changing the red edit button accessory view in a UITableViewController

I would like to draw my own edit accessory view instead of the red minus button in a UITableView. 我想绘制自己的编辑附件视图,而不是UITableView中的红色减号按钮。

Strangely setting any of them in tableView: cellForRowAtIndexPath: has no effect 奇怪地在tableView中设置它们中的任何一个:cellForRowAtIndexPath:无效

    cell.editingAccessoryType = UITableViewCellAccessoryNone;        
    cell.editingAccessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cancel"]];

since the button is set before calls to that. 因为该按钮是在调用该按钮之前设置的。

Thank you 谢谢

In order for the editing controls to be seen, editing needs to be enabled in the table view. 为了显示编辑控件,需要在表视图中启用编辑。

Try sending this to the table view: - (void)setEditing:(BOOL)editing animated:(BOOL)animate. 尝试将其发送到表格视图:-(void)setEditing:(BOOL)编辑动画:(BOOL)动画。

http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableView/setEditing:animated : http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableView/setEditing:animated

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM