как анимировать кадры при редактировании набора - PullRequest
0 голосов
/ 19 сентября 2011

Я хочу сгладить переход checkBox и noteButton, как textLabel. Я пробовал этот код, но не работает:

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {

    if (self.editing == NO) {
        self.checkBox.frame = CGRectMake(50, 0, 50, 50);
        self.noteButton.frame = CGRectMake(100, 0, 50, 50);
        self.textLabel.frame =  CGRectMake(95,0, 213, 48);
    } else {
        self.checkBox.frame = CGRectMake(10, 0, 50, 50);
        self.noteButton.frame = CGRectMake(50, 0, 50, 50);
        self.textLabel.frame =  CGRectMake(95,0, 213, 48);
    }
    [super setEditing:editing animated:animated];
}

Ответы [ 2 ]

0 голосов
/ 19 сентября 2011

Это должно работать.

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [UIView beginAnimations:@"ResizeAnimation" context:NULL];
    [UIView setAnimationDuration:0.7f];
    if (self.editing == NO) {
        self.checkBox.frame = CGRectMake(50, 0, 50, 50);
        self.noteButton.frame = CGRectMake(100, 0, 50, 50);
        self.textLabel.frame =  CGRectMake(95,0, 213, 48);
    } else {
        self.checkBox.frame = CGRectMake(10, 0, 50, 50);
        self.noteButton.frame = CGRectMake(50, 0, 50, 50);
        self.textLabel.frame =  CGRectMake(95,0, 213, 48);
    }
    [UIView commitAnimations];
    [super setEditing:editing animated:animated];
}
0 голосов
/ 19 сентября 2011

Попробуйте сделать это в

- (void) layoutSubviews {
  if (self.editing == NO) {
    self.checkBox.frame = CGRectMake(50, 0, 50, 50);
    self.noteButton.frame = CGRectMake(100, 0, 50, 50);
    self.textLabel.frame =  CGRectMake(95,0, 213, 48);
  } else {
    self.checkBox.frame = CGRectMake(10, 0, 50, 50);
    self.noteButton.frame = CGRectMake(50, 0, 50, 50);
    self.textLabel.frame =  CGRectMake(95,0, 213, 48);
  }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...