UITableViewCell 在触摸时显示子视图并在第二次触摸时隐藏它
我需要创建特定的 tableViewCell ,它在第一次触摸时显示一个特殊的子视图,并在第二次触摸时隐藏它 该子视图包含一些标签或按钮。
I need to create specific tableViewCell ,which shows a special subview on first touch and hides it on second touch That subview contains some labels or buttons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
cellForRowAtIndexPath
中,将tag
属性添加到相关单元格的子视图中。还将子视图的hidden
属性设置为YES
。最后,将单元格的selectionStyle
设置为UITableViewCellSelectionStyleNone
。然后只需对您在适当的 UITableView 委托方法中描述的内容做出反应:
确保您的“特殊”单元格具有不同的
CellIdentifier
并且这将起作用。In
cellForRowAtIndexPath
, add atag
property to the subview of the cell in question. Also set the subview'shidden
property toYES
. Finally, set the cell'sselectionStyle
toUITableViewCellSelectionStyleNone
.Then just react to what you describe in the appropriate UITableView delegate method:
Make sure your "special" cell has a different
CellIdentifier
and this will work.