ios gif icon

ios gif icon
This commit is contained in:
dmcBig
2018-05-11 16:08:18 +08:00
parent 6f731cc2b8
commit 1991181396
6 changed files with 31 additions and 10 deletions
@@ -9,4 +9,5 @@
@property(nonatomic ,strong)UIImageView *checkView;
@property(nonatomic ,strong)UILabel *labelL;
@property(nonatomic ,strong)UILabel *labelR;
@property(nonatomic ,strong)UILabel *labeGIF;
@end
@@ -32,12 +32,28 @@
self.labelR.backgroundColor= [[UIColor blackColor] colorWithAlphaComponent:0.3f];
self.labeGIF = [[UILabel alloc] initWithFrame:CGRectMake(width-width/5-5, width-labelH-2, width/5, labelH-5)];
self.labeGIF.backgroundColor = [UIColor clearColor];
self.labeGIF.textColor=[UIColor whiteColor];
self.labeGIF.text=@"\tGIF\t";
self.labeGIF.layer.cornerRadius =4;
self.labeGIF.layer.masksToBounds =YES;
self.labeGIF.textAlignment= NSTextAlignmentCenter;
self.labeGIF.baselineAdjustment= UIBaselineAdjustmentAlignCenters;
self.labeGIF.font=[UIFont systemFontOfSize:13.0];
self.labeGIF.adjustsFontSizeToFitWidth = YES;
self.labeGIF.textAlignment=NSTextAlignmentRight;
self.labeGIF.backgroundColor= [[UIColor blackColor] colorWithAlphaComponent:0.4f];
[self addSubview:self.imgView];
[self addSubview:self.whiteView];
[self addSubview:self.checkView];
[self addSubview:self.labelL];
[self addSubview:self.labelR];
[self addSubview:self.labeGIF];
}
return self;
@@ -28,7 +28,7 @@
[[self view]setBackgroundColor:[UIColor greenColor]];
UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done",nil) style:UIBarButtonItemStylePlain target:self action:@selector(done)];
UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",nil) style:UIBarButtonItemStylePlain target:self action:@selector(done)];
UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
self.navigationItem.rightBarButtonItem = rightButtonItem;
[self setDoneBtnStatus];
self.navigationItem.leftBarButtonItem=leftButtonItem;
@@ -163,11 +163,15 @@
if(asset.mediaType==PHAssetMediaTypeVideo){
cell.labelL.hidden=NO;
cell.labelR.hidden=NO;
cell.labeGIF.hidden=YES;
NSString *dtime=[NSString stringWithFormat:@"%.0f",asset.duration];
cell.labelL.text=[@"\t"stringByAppendingString:NSLocalizedString(@"Video",nil)];
cell.labelR.text=[[self getNewTimeFromDurationSecond:dtime.integerValue]stringByAppendingString:@"\t"];
}else{
NSString *fileName =[asset valueForKey:@"filename"];
NSString * fileExtension = [fileName pathExtension];
cell.labeGIF.hidden=[@"GIF" caseInsensitiveCompare:fileExtension]?YES:NO;
cell.labelL.hidden=YES;
cell.labelR.hidden=YES;
}
@@ -183,7 +187,7 @@
//UICollectionView被选中时调用的方法
-( void )collectionView:( UICollectionView *)collectionView didSelectItemAtIndexPath:( NSIndexPath *)indexPath{
NSLog(@"%ld",(long)indexPath.row);
PHAsset * asset=fetchResult[indexPath.row];
NSInteger i=[self isSelect:asset];
CollectionViewCell *cell = (CollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
+6 -6
View File
@@ -145,14 +145,14 @@
} else if(exportSession.status == AVAssetExportSessionStatusCompleted){
NSLog(@"completed!");
NSLog(@"completed!");
NSString *compressCompletedjs = [NSString stringWithFormat:@"MediaPicker.compressEvent('%@',%i)", @"completed",index];
[self.commandDelegate evalJs:compressCompletedjs];
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:fullpath,@"path",@"video",@"mediaType" ,[NSNumber numberWithInt:index],@"index", nil];
[aListArray addObject:dict];
if([aListArray count]==[selectArray count]){
[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:aListArray] callbackId:callbackId];
}
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:fullpath,@"path",@"video",@"mediaType" ,[NSNumber numberWithInt:index],@"index", nil];
[aListArray addObject:dict];
if([aListArray count]==[selectArray count]){
[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:aListArray] callbackId:callbackId];
}
}
}];