4

画面にいくつかのラベルを含む UIView があります。ビューを反転するトランジションを作成しようとしていますが、アニメーションの途中ですぐにラベルを更新できるようにしたいと考えています。どうすればこれを達成できますか?

[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

1 に答える 1

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;
                }
            }];
于 2012-11-19T21:36:08.533 に答える