Commit c6453b4f authored by yuzheng.tz's avatar yuzheng.tz

新增tz_containsString方法判断是否包含某子串

parent f538a4f1
...@@ -187,7 +187,7 @@ static dispatch_once_t onceToken; ...@@ -187,7 +187,7 @@ static dispatch_once_t onceToken;
} }
} }
if ([collection.localizedTitle containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue; if ([collection.localizedTitle tz_containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue;
if ([self isCameraRollAlbum:collection.localizedTitle]) { if ([self isCameraRollAlbum:collection.localizedTitle]) {
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:0]; [albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle] atIndex:0];
} else { } else {
......
...@@ -225,8 +225,11 @@ ...@@ -225,8 +225,11 @@
@interface UIImage (MyBundle) @interface UIImage (MyBundle)
+ (UIImage *)imageNamedFromMyBundle:(NSString *)name; + (UIImage *)imageNamedFromMyBundle:(NSString *)name;
@end
@interface NSString (TzExtension)
- (BOOL)tz_containsString:(NSString *)string;
@end @end
...@@ -695,3 +695,17 @@ ...@@ -695,3 +695,17 @@
} }
@end @end
@implementation NSString (TzExtension)
- (BOOL)tz_containsString:(NSString *)string {
if (iOS8Later) {
return [self containsString:string];
} else {
NSRange range = [self rangeOfString:string];
return range.location != NSNotFound;
}
}
@end
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
if ([asset isKindOfClass:[PHAsset class]]) { if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = asset; PHAsset *phAsset = asset;
_videoImageView.hidden = phAsset.mediaType != PHAssetMediaTypeVideo; _videoImageView.hidden = phAsset.mediaType != PHAssetMediaTypeVideo;
_gifLable.hidden = ![[phAsset valueForKey:@"filename"] containsString:@"GIF"]; _gifLable.hidden = ![[phAsset valueForKey:@"filename"] tz_containsString:@"GIF"];
} else if ([asset isKindOfClass:[ALAsset class]]) { } else if ([asset isKindOfClass:[ALAsset class]]) {
ALAsset *alAsset = asset; ALAsset *alAsset = asset;
_videoImageView.hidden = ![[alAsset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]; _videoImageView.hidden = ![[alAsset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo];
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
ALAsset *alAsset = asset; ALAsset *alAsset = asset;
isVideo = [[alAsset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]; isVideo = [[alAsset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo];
} }
if ([[asset valueForKey:@"filename"] containsString:@"GIF"] && self.allowPickingGifSwitch.isOn && !self.allowPickingMuitlpleVideoSwitch.isOn) { if ([[asset valueForKey:@"filename"] tz_containsString:@"GIF"] && self.allowPickingGifSwitch.isOn && !self.allowPickingMuitlpleVideoSwitch.isOn) {
TZGifPhotoPreviewController *vc = [[TZGifPhotoPreviewController alloc] init]; TZGifPhotoPreviewController *vc = [[TZGifPhotoPreviewController alloc] init];
TZAssetModel *model = [TZAssetModel modelWithAsset:asset type:TZAssetModelMediaTypePhotoGif timeLength:@""]; TZAssetModel *model = [TZAssetModel modelWithAsset:asset type:TZAssetModelMediaTypePhotoGif timeLength:@""];
vc.model = model; vc.model = model;
......
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