2011-09-19 2 views
0

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]; 
} 

답변

0

이 작동합니다에서 그 일을.

- (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

시도가

- (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); 
    } 
} 
+0

이 코드도 작동합니다. –

관련 문제