Commit 6f7646b5 authored by banchichen's avatar banchichen

加入获取照片名字的示例

parent 2de6a168
...@@ -288,7 +288,6 @@ ...@@ -288,7 +288,6 @@
TargetAttributes = { TargetAttributes = {
900E657B1C2BB8D5003D9A9E = { 900E657B1C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
DevelopmentTeam = ZH74J4ERQH;
}; };
900E65941C2BB8D5003D9A9E = { 900E65941C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
......
...@@ -352,6 +352,9 @@ ...@@ -352,6 +352,9 @@
_isSelectOriginalPhoto = isSelectOriginalPhoto; _isSelectOriginalPhoto = isSelectOriginalPhoto;
[_collectionView reloadData]; [_collectionView reloadData];
// _collectionView.contentSize = CGSizeMake(0, ((_selectedPhotos.count + 2) / 3 ) * (_margin + _itemWH)); // _collectionView.contentSize = CGSizeMake(0, ((_selectedPhotos.count + 2) / 3 ) * (_margin + _itemWH));
// 1.打印图片名字
[self printAssetsName:assets];
} }
// If user picking a video, this callback will be called. // If user picking a video, this callback will be called.
...@@ -372,7 +375,7 @@ ...@@ -372,7 +375,7 @@
// _collectionView.contentSize = CGSizeMake(0, ((_selectedPhotos.count + 2) / 3 ) * (_margin + _itemWH)); // _collectionView.contentSize = CGSizeMake(0, ((_selectedPhotos.count + 2) / 3 ) * (_margin + _itemWH));
} }
#pragma mark Click Event #pragma mark - Click Event
- (void)deleteBtnClik:(UIButton *)sender { - (void)deleteBtnClik:(UIButton *)sender {
[_selectedPhotos removeObjectAtIndex:sender.tag]; [_selectedPhotos removeObjectAtIndex:sender.tag];
...@@ -424,4 +427,21 @@ ...@@ -424,4 +427,21 @@
[self.view endEditing:YES]; [self.view endEditing:YES];
} }
#pragma mark - Private
/// 打印图片名字
- (void)printAssetsName:(NSArray *)assets {
NSString *fileName;
for (id asset in assets) {
if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = (PHAsset *)asset;
fileName = [phAsset valueForKey:@"filename"];
} else if ([asset isKindOfClass:[ALAsset class]]) {
ALAsset *alAsset = (ALAsset *)asset;
fileName = alAsset.defaultRepresentation.filename;;
}
NSLog(@"图片名字:%@",fileName);
}
}
@end @end
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