Last active
March 8, 2017 00:26
-
-
Save mtsd/1398863 to your computer and use it in GitHub Desktop.
iOSのバージョン判定
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
| #import <Foundation/Foundation.h> | |
| CGFloat iOSVersion(); | |
| BOOL isIOSVersionOver(float v); | |
| BOOL isIOSVersionOver_3_2(); | |
| BOOL isIOSVersionOver_5_0(); |
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
| #import "deviceVersionUtility.h" | |
| CGFloat iOSVersion() | |
| { | |
| return [[[UIDevice currentDevice] systemVersion] floatValue]; | |
| } | |
| /* | |
| if (isIOSVersionOver(5.0f)) { | |
| ... | |
| } | |
| */ | |
| BOOL isIOSVersionOver(float v) | |
| { | |
| float version = iOSVersion(); | |
| return version >= v; | |
| } | |
| BOOL isIOSVersionOver_3_2() | |
| { | |
| float version = iOSVersion(); | |
| return version >= 3.2f; | |
| } | |
| BOOL isIOSVersionOver_5_0() | |
| { | |
| float version = iOSVersion(); | |
| return version >= 5.0f; | |
| } |
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
| /** | |
| MACRO | |
| */ | |
| #define SYSTEM_VERSION_LESS_THAN(v) \ | |
| ( [[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending ) | |
| if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { | |
| // iOS7 | |
| } else { | |
| // iOS8 - | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment