标签:
对于系统中过时的方法或者是为了向下兼容兼容不同的版本使用最新的方法都要判断当前的系统版本号,在进行方法的调用
````objc
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo NS_DEPRECATED_IOS(2_0, 3_0);
说明方法在2.0时代引入,3.0时代过时
````
````objc
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
if([picker respondsToSelector:@selector(dismissModalViewControllerAnimated:)]){
[picker dismissModalViewControllerAnimated:YES completion:nil];
}
else
#endif
{
[picker dismissViewControllerAnimated:YES completion:nil];
}
````
````objc
if([picker respondsToSelector:@selector(imagePickerController:didFinishPickingMediaWithInfo:)]){
[picker dismissViewControllerAnimated:YES completion:nil];
}else{
[picker dismissModalViewControllerAnimated:YES];
}
````
标签:
原文地址:http://www.cnblogs.com/zj901203/p/5151185.html