Created
June 22, 2012 07:01
-
-
Save ttsubono/2970887 to your computer and use it in GitHub Desktop.
self.viewをフリップ(水平回転)して別のビューに切り替える(&戻す)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FLIP_ANIMATION_DURATION 0.5 | |
static BOOL flipFromLeft = YES; | |
// secondViewを作る | |
if (flipFromLeft) { | |
secondView = ... // Flipして表示したいsecondViewにインスタンス割り当て(secondViewというメンバー変数があること) | |
} | |
// self.view -> secondViewへFlipして切り替える | |
[UIView transitionFromView:(flipFromLeft ? self.view : secondView) | |
toView:(flipFromLeft ? secondView : self.view) | |
duration:FLIP_ANIMATION_DURATION | |
options:(flipFromLeft ? UIViewAnimationOptionTransitionFlipFromLeft : UIViewAnimationOptionTransitionFlipFromRight) | |
completion:nil | |
]; | |
// self.viewに戻ったときはsecondViewは表示されていないので削除する | |
if (!flipFromLeft) { | |
[secondView removeFromSuperview]; | |
[secondView release]; | |
secondView = nil; | |
} | |
// 左右のフリップを交互に繰り返す | |
flipFromLeft = !flipFromLeft; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UIView Class Reference
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html
UIViewのアニメーションのAppleのプログラミングガイド
http://developer.apple.com/jp/devcenter/ios/library/documentation/ViewPG_iPhoneOS.pdf
UIViewAnimationOptionsの定数の解説
http://marutanm.hatenablog.com/entry/20100630/p1
トランジションアニメーションの解説
http://blog.livedoor.jp/second_flush/archives/51094763.html
UIView animation系メソッドの解説
http://blog.livedoor.jp/second_flush/archives/51141404.html