如何在 iPhone 中以编辑模式显示表格?
在应用程序中,我有自定义的 tableview,它是 uiviewcontroller 和 uiviewcontroller 的子类;当我显示 self.navigationItem.rightBarButtonItem = self.editButtonItem; 时,我想在 tableview 中显示编辑 当我单击它时,桌面视图不显示红色减号。 我哪里错了&我要做什么才能摆脱它?
in app i have custom tableview which subclass of uiviewcontroller & i want to show editing in tableview when i show self.navigationItem.rightBarButtonItem = self.editButtonItem;
when i clicked on it the tableview doesn't show red minus sign.
where i was wrong & what i do for come out from it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 self.editButtonItem;仅:如果您的类是 UITableViewController 子类的子类。
如果 UIViewController 子类 self.editBarButtonItem 不起作用。
在这种情况下,您可以使用
self.navigationItem.rightBarButtonItem=[[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(edit:)] autorelease];
并在编辑方法中设置编辑
-(void)edit:(id)sender
{
myTable.editing=YES;
}
You can use self.editButtonItem; only : in case your class is a subclass of UITableViewController sub class .
In case of UIViewController sub class self.editBarButtonItem does not work.
In this case you can use
self.navigationItem.rightBarButtonItem=[[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(edit:)] autorelease];
and in edit method set editing
-(void)edit:(id)sender
{
myTable.editing=YES;
}