Commit 5caefc91 authored by lujunye's avatar lujunye

32

parent 66f4791b
......@@ -81,12 +81,14 @@ class HGImagePickerController: UIViewController {
private func convertCollection(collection:PHFetchResult<PHAssetCollection>){
for i in 0..<collection.count{
//获取出但前相簿内的图片
let resultsOptions = PHFetchOptions()
resultsOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate",
ascending: false)]
resultsOptions.predicate = NSPredicate(format: "mediaType = %d",
PHAssetMediaType.image.rawValue)
let c = collection[i]
if c.isKind(of: PHAssetCollection.self){
let assetsFetchResult = PHAsset.fetchAssets(in: c , options: resultsOptions)
//没有图片的空相簿不显示
if assetsFetchResult.count > 0 {
......@@ -96,6 +98,7 @@ class HGImagePickerController: UIViewController {
}
}
}
}
//由于系统返回的相册集名称为英文,我们需要转换为中文
private func titleOfAlbumForChinse(title:String?) -> String? {
......
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