使用自定义 UITableViewCell 的附件视图显示两个项目
我已经寻找这个有一段时间了,但还没有找到答案(归咎于糟糕的谷歌搜索技巧)。我有一个自定义 UITableViewCell
类,目前由一个自定义 UISwitch
和一个 UILabel
组成。我想添加一个仅当开关设置为“是”时才可见(且处于活动状态)的按钮。现在,我将开关添加到 accessoryView
中,然后保留它。但是,据我所知,附件视图实际上并没有子视图,所以这是我的问题:
我是否应该创建一个具有按钮和开关的 UIView,调整其大小以适合单元格的附件视图(或者它会自动调整大小吗?),并将其作为单元格的附件视图放入?这是通常的情况吗?
或者有我缺少的解决方案吗?
谢谢。
I've been looking for this for a while, but haven't found an answer (blame poor googling skills). I have a custom UITableViewCell
class which, currently, consists of a custom UISwitch
and a UILabel
. I want to add a button that's only visible (And active) when the switch is set to "Yes". Right now I add the switch to the accessoryView
, and leave it. However, the accessory view doesn't really have subviews, as far as I can tell, so here's my question:
Should I just create a UIView
that has a button and a switch, size it to fit the cell's accessory view (or will it auto-size itself?), and put that in as the cell's accessory view? And is this typically the way that it's gone about?
Or is there a solution that I'm missing?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个例子:
Here is an example: