Issue with disabling UITableView custom cell from indenting while in editing mode

Discussion in 'iOS Programming' started by ord6, Mar 8, 2013.

  1. ord6, Mar 8, 2013
    Last edited by a moderator: Mar 8, 2013

    ord6 macrumors newbie

    Joined:
    Jun 19, 2012
    #1
    I disabled the cell indentation while in edit mode.
    In the custom cell's layoutSubviews method I added:
    Code:
    float indentPoints = self.indentationLevel * self.indentationWidth;
        
        self.contentView.frame = CGRectMake(indentPoints,
                                            self.contentView.frame.origin.y,
                                            self.contentView.frame.size.width - indentPoints,
                                            self.contentView.frame.size.height
                                            );
    
    The problem is when I click the edit control mark (the minus sign) once to show the delete confirmation button, and then I press the edit control again, the delete confirmation is dismissed but the cell is jumping for some reason.

    Here is a video showing the issue: .

    Any idea how I can remove this jumping?
     
  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    Did you try wrapping your frame change in an animation block?
     
  3. ord6 thread starter macrumors newbie

    Joined:
    Jun 19, 2012
    #3
    What to you mean? I don'e want the cell's frame to move at all.
    Thanks!
     
  4. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #4
    Try wrapping your content frame change I'm a uiview animation block instead of just changing the frame.
     
  5. ord6 thread starter macrumors newbie

    Joined:
    Jun 19, 2012
    #5
    I tried this:

    Code:
    [UIView animateWithDuration: 0
                              delay: 0
                            options: (UIViewAnimationOptionTransitionNone)
                         animations:^{
                             float indentPoints = 
                             self.indentationLevel * self.indentationWidth;
                             
                             self.contentView.frame = CGRectMake(indentPoints,
                                                                 self.contentView.frame.origin.y,
                                                                 self.contentView.frame.size.width - indentPoints,
                                                                 self.contentView.frame.size.height);
                        }
                         completion:^(BOOL finished) { }
         ];
        
    
    It just adds another jump.
    Is that what you meant?
     
  6. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #6
    That is what I was meaning originally. Let me put a sample project together to see if i get the same behavior. I'll get back to you on it.

    Also try the animation option begin from current state and see what that does.
     
  7. ord6 thread starter macrumors newbie

    Joined:
    Jun 19, 2012
    #7
    Thanks!

    It adds another jump as well.
     

Share This Page