質問
をご検討ください以下のコードは、いかなっている間違っています。
いフリップの間にUIViews.
なんか、私はフリップから初期の大きな展開をもたらしていかに反転授業見なします。私はフリップ、アニメーションの表示です。
の切り替えは、はっきからボタンを望めます。
- (IBAction)showMoreInfo:(id)sender
{
UIView *moreInfo = self.flipView;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
UIView *parent = self.view.superview;
[self.view removeFromSuperview];
[parent addSubview:moreInfo];
[UIView commitAnimations];
}
- (IBAction)showLessInfo:(id)sender
{
UIView *lessInfo = self.view;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.flipView cache:YES];
UIView *parent = self.flipView.superview;
[self.flipView removeFromSuperview];
[parent addSubview:lessInfo];
[UIView commitAnimations];
}
解決
そん用コンテナのビューに遷移す。マニュアルを参照してる setAnimationTransition:forView:キャッシュ:
変更したい場合は、外観のビュー中の遷移例えば、フリップからの眺めもう少しコンテナのビューのインスタンスUIViewて
- 開始のアニメーションブロックです。
- 設定の移行を容器。
- を削除しsubviewコンテナからの眺め。
- 追加のsubviewのコンテナ。
- コミットアニメーションブロックです。
使ってみ self.view.superview
アニメーションの移行の showMoreInfo:
その理由の showLessInfo:
方法はお使いのコンテナ。
他のヒント
あなたはUIViewのからUIWindowの固有性としてコンテナビューとしてあなたのメインウィンドウ(UIWindow)を使用することはできますか?
また、iPhone 3.0はpresentModalViewControllerメソッドを介してフリップフロッ取引を導入します:
CustomViewController *vc = [[CustomViewController alloc]
initWithNibName:@"CustomViewController" bundle:nil];
vc.delegate = self;
// The magic statement. This will flip from right to left.
// present the modal view controller then when you dismissModalViewController
// it will transition flip from left to right. Simple and elegant.
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:vc animated:YES];
[vc release];
のiOS 4.0の後、あなたはこれでビュー間を反転させることができます:
[UIView transitionFromView:sourceView toView:destinationView duration:0.35f options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
NSLog(@"I just flipped!");
}];
ジェイソンが述べたように、あなたはコンテナビュー内で発生し、これを必要があります。
所属していません StackOverflow