keeping the selection permanent in UITableviewCell

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

  1. ulquiorra macrumors member

    Joined:
    Jun 17, 2009
    #1
    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

    http://img129.imageshack.us/img129/4050/samplec.png

    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.

    http://img245.imageshack.us/img245/5930/sample3i.png

    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 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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

    Joined:
    Jun 17, 2009
    #3
    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

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    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