Commit 385a327d authored by yuzheng.tz's avatar yuzheng.tz

使用@available消除警告

parent ea2a58fd
...@@ -372,7 +372,7 @@ static dispatch_once_t onceToken; ...@@ -372,7 +372,7 @@ static dispatch_once_t onceToken;
if (phAsset.mediaType == PHAssetMediaTypeVideo) type = TZAssetModelMediaTypeVideo; if (phAsset.mediaType == PHAssetMediaTypeVideo) type = TZAssetModelMediaTypeVideo;
else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = TZAssetModelMediaTypeAudio; else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = TZAssetModelMediaTypeAudio;
else if (phAsset.mediaType == PHAssetMediaTypeImage) { else if (phAsset.mediaType == PHAssetMediaTypeImage) {
if (iOS9_1Later) { if (@available(iOS 9.1, *)) {
// if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto; // if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto;
} }
// Gif // Gif
...@@ -686,7 +686,7 @@ static dispatch_once_t onceToken; ...@@ -686,7 +686,7 @@ static dispatch_once_t onceToken;
- (void)savePhotoWithImage:(UIImage *)image location:(CLLocation *)location completion:(void (^)(NSError *error))completion { - (void)savePhotoWithImage:(UIImage *)image location:(CLLocation *)location completion:(void (^)(NSError *error))completion {
if (iOS8Later) { if (iOS8Later) {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
if (iOS9Later) { if (@available(iOS 9, *)) {
NSData *data = UIImageJPEGRepresentation(image, 0.9); NSData *data = UIImageJPEGRepresentation(image, 0.9);
PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init]; PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init];
options.shouldMoveFile = YES; options.shouldMoveFile = YES;
...@@ -743,7 +743,7 @@ static dispatch_once_t onceToken; ...@@ -743,7 +743,7 @@ static dispatch_once_t onceToken;
- (void)saveVideoWithUrl:(NSURL *)url location:(CLLocation *)location completion:(void (^)(NSError *error))completion { - (void)saveVideoWithUrl:(NSURL *)url location:(CLLocation *)location completion:(void (^)(NSError *error))completion {
if (iOS8Later) { if (iOS8Later) {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
if (iOS9Later) { if (@available(iOS 9, *)) {
PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init]; PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init];
options.shouldMoveFile = YES; options.shouldMoveFile = YES;
PHAssetCreationRequest *request = [PHAssetCreationRequest creationRequestForAsset]; PHAssetCreationRequest *request = [PHAssetCreationRequest creationRequestForAsset];
......
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f) #define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f) #define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define iOS11Later ([UIDevice currentDevice].systemVersion.floatValue >= 11.0f)
@class TZAlbumCell, TZAssetCell; @class TZAlbumCell, TZAssetCell;
@protocol TZImagePickerControllerDelegate; @protocol TZImagePickerControllerDelegate;
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
- (void)configBarButtonItemAppearance { - (void)configBarButtonItemAppearance {
UIBarButtonItem *barItem; UIBarButtonItem *barItem;
if (iOS9Later) { if (@available(iOS 9, *)) {
barItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; barItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];
} else { } else {
barItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil]; barItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil];
......
...@@ -61,7 +61,7 @@ static CGFloat itemMargin = 5; ...@@ -61,7 +61,7 @@ static CGFloat itemMargin = 5;
} }
_imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
UIBarButtonItem *tzBarItem, *BarItem; UIBarButtonItem *tzBarItem, *BarItem;
if (iOS9Later) { if (@available(iOS 9, *)) {
tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];
BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]];
} else { } else {
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
_scrollView.delaysContentTouches = NO; _scrollView.delaysContentTouches = NO;
_scrollView.canCancelContentTouches = YES; _scrollView.canCancelContentTouches = YES;
_scrollView.alwaysBounceVertical = NO; _scrollView.alwaysBounceVertical = NO;
if (iOS11Later) { if (@available(iOS 11, *)) {
_scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} }
[self addSubview:_scrollView]; [self addSubview:_scrollView];
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
} }
_imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
UIBarButtonItem *tzBarItem, *BarItem; UIBarButtonItem *tzBarItem, *BarItem;
if (iOS9Later) { if (@available(iOS 9, *)) {
tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]]; tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];
BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]]; BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]];
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment