2012-11-19 3 views
4

몇 개의 레이블이 포함 된 UIView가 화면에 있습니다. 저는보기를 뒤집을 전환을 시도하고 있습니다. 반향을 통해 반쯤 지나면 레이블을 업데이트 할 수 있기를 원합니다. 어떻게 이것을 얻을 수 있습니까?iOS - 애니메이션 전환 중에 라벨을 업데이트 하시겠습니까?

[UIView transitionWithView:self.myView 
          duration:.7 
          options:UIViewAnimationOptionTransitionFlipFromBottom 
         animations:^{ 
          // It doesn't update the labels here, until I scoll the tableview (containing the view) 
          //[self.myView update]; 
              } 
         completion:^(BOOL finished){ 
          // It doesn't look nice here because it doesn't look smooth, the label flashes and changes after the animation is complete 
          //[self.myView update]; 
         }]; 

답변

4

문제점은 애니메이 션 중에 컨텐츠를 업데이트 할 수 없도록 설정해야한다는 것이 문제였습니다. 해결책은 애니메이션보다 먼저 래스터 화를 해제하고 애니메이션이 완료된 후 다시 켜는 것이 었습니다.

내가 래스터 화를 제거하지 않은 이유는 뷰가 tableView 내부에 있고, 래스터 화가 tableView를 스크롤하는 동안 여전히 도움이된다는 것입니다.

self.layer.shouldRasterize = NO; 

[UIView transitionWithView:self 
       duration:animationDuration 
       options:UIViewAnimationOptionTransitionFlipFromBottom 
      animations:^{/*update the content here, I did it outside of the transition method though*/} 
      completion:^(BOOL finished){ 
       if (finished) 
       { 
          self.layer.shouldRasterize = YES; 
       } 
      }]; 
관련 문제