自定义 UITableCellView 用户交互
我为我的应用程序创建了一个自定义 UITableCellView。每个单元格有两个按钮。我面临的问题是单元格本身是可选择的,这会导致用户困惑和设计不佳。如何禁用单元格的交互,但保持单元格中 UIButtons 的交互启用?
谢谢! 萨蒂扬
I created a Custom UITableCellView for my application. Each cell has two buttons. The problem I am facing is that the cell itself is selectable which leads to a confused user and poor design. How do I disable the interaction for the cell but keep the interaction enabled for the UIButtons in the cell?
Thanks!
Satyam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以设置
cell.selectionStyle = UITableViewCellSelectionStyleNone;
并确保保持didSelectRowAtIndexPath
未实现。这意味着您的单元格将无法交互,但您仍然可以从按钮获取消息。除此之外,我当然不知道您想要实现什么,但请记住,您可以使用 UITableViewCellAccessoryDetailDisclosureButton 作为附件视图,这是与单元格本身不同的“按钮”。更多信息这里。
You can set the
cell.selectionStyle = UITableViewCellSelectionStyleNone;
and be sure to keep yourdidSelectRowAtIndexPath
unimplemented. That means that your cells will not be interactive, but you can still get messages from your buttons.Apart from that, of course I don't know what you're trying to achieve, but remember that you can use a UITableViewCellAccessoryDetailDisclosureButton as an accessory view, which is a different "button" from the cell itself. More info here.