Need help with UITableView Edit Mode event handling

Discussion in 'iOS Programming' started by pwturben, Mar 17, 2010.

  1. pwturben macrumors newbie

    Joined:
    Jan 27, 2010
    #1
    Hello.

    my problem:


    I have and UITableView. This table have some rows.
    I wanted to implement deleting rows usin this method:



    At first, i have and "edit" button on the left of UINavigation bar.
    I have a method connected to this button, he has a string:
    (ComplaintsTable - its my UITableView)

    [ComplaintsTable setEditing:YES animated:YES];

    when im pressing "Edit" button, starts standart animation, and (-) red icons appeared. All is ok.
    [​IMG]

    Notice, that i have label with "Yesterday" text. < its date


    Then, when im pressing (-) button - its become (|) button, and "Delete" button appears:
    [​IMG]

    look - my Yesterday label is under "Delete" button. I need to hide that.
    Of course i cant make it smaller and hide under delete, coz there will be any text of any size and any length.


    My problem is.
    Im trying to Hide this label with text "Yesterday"

    I want to hide this label when i press (-) button.
    How can i handle event, when (-) - red button in some cell is pressed ?


    Thanks

    p.s.:its like a standart mechanism in "SMS" or other. Hiding date when u are editing some row.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    The table will automatically resize your cell when the delete button appears. You need to set the autoResizingMask for the label. I have one that's like this and seems to work

    Code:
    label.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
     
  3. pwturben thread starter macrumors newbie

    Joined:
    Jan 27, 2010
    #3
    yeah. Some magic with label width, and with the bit mask of AutoResising mask and all works great!

    Thanks. Hope its a good implementation. But who can judge winners?label is hidden!:D
     

Share This Page