keeping the selection permanent in UITableviewCell

Discussion in 'iOS Programming' started by ulquiorra, Sep 1, 2009.

  1. ulquiorra macrumors member

    Jun 17, 2009
    Hello all ,

    I seem to be having a problem in my UITableView clicking behaviour. I'm using a Tree to create a hiearchy of tableviews.

    My problem arises when I enter the following screen ( I produced some screenshots to clarify ).

    1) When I enter this screen

    I can go to my next tableview by clicking on my info button below( second from the left)( so not by clicking on the cell). This works. It will go to the tableview associated with the previous row.

    Here is where my "problem" starts. As soon as I click outside my current tableview , for instance on the empty cell below or if I click the same cell and drag it a bit, then my cell will become unselected.

    2) As you can see in the image below.

    I do not want this to happen. I want my cell despite the fact that I'm clicking around to stay selected. Is there a way to realize this?
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    The cell stays selected until your code unselects it. This happens explicitly by deselectRowAtIndexPath and implicitly by reloadData. Maybe also by beginUpdates/endUpdates. A memory warning will also result in it being deselected probably. The selection remains even if you push another view controller and then touch the back button.
  3. ulquiorra thread starter macrumors member

    Jun 17, 2009
    thnx for your reply... but I've managed to solve it.
    I created an extra variable in which i saved my previously selected cell and then call that one when I hit the button..
    But I appreciate the explanation and your answer.
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    I believe the Mobile HIG states you shouldn't leave table cells permanently selected (they are only used to indicate with momentary visual feedback that a selection has been triggered) and that you should use some other mechanism, such as a check-mark, to indicate permanent selection.

Share This Page