Last active
March 31, 2017 01:57
-
-
Save mexelout/30767668dcd7f0d2e12349963d8acce8 to your computer and use it in GitHub Desktop.
UIViewControllerの下位互換をしてくれるラッピング関数 ios4 - ios5 もう要らないコードかも?
This file contains hidden or 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
// view controller wrapping function | |
/** | |
* プレゼントビューコントローラーのラッピング関数 | |
* @param me 呼び出すを行うビューコントローラー(基本的にはselfを指定) | |
* @param vc 呼び出しをされるビューコントローラー | |
* @param flag アニメーションフラグ | |
* @param comp 終了後に呼ぶブロック関数 | |
*/ | |
void presentViewController(UIViewController* me, UIViewController* vc, BOOL flag, void* comp) { | |
// ios 4まではpresentModalViewController | |
// ios 5以降はpresentViewController | |
// で動かさなくてはならない | |
if(iOSVersion < 5) { | |
[me presentModalViewController:vc animated:flag]; | |
} else { | |
[me presentViewController:vc animated:flag completion:comp]; | |
} | |
} | |
/** | |
* ディスミスビューコントローラーのラッピング関数 | |
* @param me 呼び出すを行うビューコントローラー(基本的にはselfを指定) | |
* @param flag アニメーションフラグ | |
* @param comp 終了後に呼ぶブロック関数 | |
*/ | |
void dismissViewController(UIViewController* me, BOOL flag, void* comp) { | |
// ios 4まではdismissModalViewController | |
// ios 5以降はdismissViewController | |
// で動かさなくてはならない | |
if(iOSVersion < 5) { | |
[me dismissModalViewControllerAnimated:YES]; | |
} else { | |
[me dismissViewControllerAnimated:flag completion:comp]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment