如何在 iPhone 中以编辑模式显示表格?

发布于 2024-10-06 08:49:04 字数 204 浏览 0 评论 0原文

在应用程序中,我有自定义的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爺獨霸怡葒院 2024-10-13 08:49:04

您可以使用 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;
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文