Skip to content

Instantly share code, notes, and snippets.

@ethanbing
Created October 29, 2014 01:38
Show Gist options
  • Save ethanbing/f844fe8ec24f44a502f0 to your computer and use it in GitHub Desktop.
Save ethanbing/f844fe8ec24f44a502f0 to your computer and use it in GitHub Desktop.
iOS判断版本
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