Animating custom-drawn UITableViewCell when entering edit mode

后端 未结 6 1553
攒了一身酷
攒了一身酷 2020-12-12 09:53

Background

First of all, much gratitude to atebits for their very informative blog post Fast Scrolling in Tweetie with UITableView. The post explains in detail how

6条回答
  •  离开以前
    2020-12-12 10:18

    How are you moving the text around currently? Or more specifically, in which UITableViewCell method are you performing the move?

    From my experience, overriding the layoutSubviews method and setting the frame here will automatically be wrapped in an animation.

    Eg:

    - (void)layoutSubviews {
        if (self.editing) {
            [titleLabel setFrame:CGRectMake(62, 6, 170, 24)];
        }
        else {
            [titleLabel setFrame:CGRectMake(30, 6, 200, 24)];
        }
        [super layoutSubviews];
    }
    

提交回复
热议问题