编辑模式删除特定 TableView 行的微调器图标
我有一个分组的表格视图。每个部分有三行。我需要能够一次删除一个部分。使用标准编辑模式,我可以让它工作。但是,删除图标显示在每个单元格的左侧,而不仅仅是每个部分的第一行。
有没有办法抑制除第一行之外的所有行的小微调器图标?
我希望有一种简单的方法可以做到这一点而无需子类化。
以下屏幕截图可帮助您直观地看到它:http://picasaweb.google .com/lh/photo/ll-EJY5ACw7oqHH1xKBQ8w?feat=directlink
I have a grouped tableview. Each section has three rows. I need to be able to delete one section at a time. Using the standard edit mode, I can make it work. However, the delete icon shows up to the left of each cell, not just the first row in each section.
Is there a way to suppress the little spinner icon for all rows except the first?
I am hoping there is an easy way to do this without subclassing.
Here is a screenshot to help visualize it: http://picasaweb.google.com/lh/photo/ll-EJY5ACw7oqHH1xKBQ8w?feat=directlink
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
不要删除行,而是创建一个包含
UILabel
和自定义UIButton
作为子视图的父UIView
。将此父视图设置为 节标题视图。应连接按钮以触发删除行的方法,例如,翻转该部分的
BOOL
状态标志,然后重新加载表:您的
-numberOfSectionsInTableView:
委托方法将根据此布尔标志的状态相应地调整其输出,例如Instead of deleting rows, make a parent
UIView
that contains aUILabel
and customUIButton
as subviews. Set this parent view as the section header view.The button should be wired up to trigger a method that deletes rows by, for example, flipping a
BOOL
state flag for that section and then reloading the table:Your
-numberOfSectionsInTableView:
delegate method will accordingly adjust its output depending on the state of this boolean flag, e.g.