开发者

How can i check a ALAsset is a Image .How can i seperate image(.png) files from ALAssetGroup

开发者 https://www.devze.com 2023-02-24 04:41 出处:网络
How can i check a ALAsset is aImage? How can i seperate image(.p开发者_运维知识库ng) files from ALAssetGroup.can i able to retrieve only the image(.png) files from iphone Photo libaray ?First of all y

How can i check a ALAsset is a Image? How can i seperate image(.p开发者_运维知识库ng) files from ALAssetGroup.can i able to retrieve only the image(.png) files from iphone Photo libaray ?


First of all you need to enumerate the whole AssetGroup Then check every asset for 2 things:

1) For checking if the Asset is an image, query

[[asset valueForProperty:@"ALAssetPropertyType"] isEqualToString:@"ALAssetTypePhoto"]

2) if 1) is true then continue the check, if it is a PNG like this:

[[[asset defaultRepresentation] UTI] isEqualToString:@"public.png"]


Without using NSString:

[[asset valueForProperty:ALAssetPropertyType] isEqual:ALAssetTypeVideo]

0

精彩评论

暂无评论...
验证码 换一张
取 消