How to use first responder to keep only one cell selected at the maximum in a view with multiple table views?
I have a scrollview which has several table views as sub views... say that I have selected a cell in one of the sub views. Now when I select a cell from another view, the cell I selected previously should not be highlighted. How do I do this? I know I can do this using the first r开发者_JAVA百科esponder, but I am not sure how to do it. Would anyone be able to help me out in this?
Thanks
From the apple interface guidlines:
Always provide feedback when users select a list item. Users expect a table row to highlight briefly when they tap a selectable item in it. After tapping, users expect an immediate action to occur: Either a new view appears or the row displays a checkmark to indicate that the item has been selected or enabled.
In rare cases, a row might remain highlighted when secondary details or controls related to the row item are displayed in the same screen. However, this is not encouraged because it is difficult to display simultaneously a list of choices, a selected item, and related details or controls without creating an uncomfortably crowded layout.
I don't think apple will approve an app that leaves a row highlighted (I had an app reject for that very reason). You should perform an action and then immediately unhighlight it. In some rare cases you can leave it highlighted while showing a related view.
However, if you store the current cell you have selected, you can call -deselectRowAtIndexPath:animated: on the tableview to deselect a row.
精彩评论