Created
October 29, 2014 01:38
-
-
Save ethanbing/f844fe8ec24f44a502f0 to your computer and use it in GitHub Desktop.
iOS判断版本
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
1. iOS版本确认 | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) { | |
bannerView = [[ADBannerView alloc] init]; | |
bannerView.delegate = self; | |
[self.view addSubview:bannerView]; | |
} | |
2. 新类是否存在 | |
Class clazz = NSClassFromString(@"ADBannerView"); | |
if (clazz) { | |
bannerView = [[ADBannerView alloc] init]; | |
bannerView.delegate = self; | |
[self.view addSubview:bannerView]; | |
} | |
3. 新接口是否存在 | |
if (UIGraphicsBeginImageContextWithOptions != NULL) { | |
bannerView = [[ADBannerView alloc] init]; | |
bannerView.delegate = self; | |
[self.view addSubview:bannerView]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment