Photos(PHCollectionListChangeRequest)

本文介绍如何使用Photos框架创建、删除及修改相册列表(PHCollectionList)。内容涵盖创建新的PHCollectionList、删除现有列表以及通过多种方法修改列表,如添加、插入、删除和替换子集合等。

Photos(PHAssetChangeRequest)

Photos(PHAssetCreationRequest)

Photos(PHAssetCollectionChangeRequest)

Photos(PHCollectionListChangeRequest)


PHCollectionListChangeRequest可创建、删除和修改PHCollectionList对象。

1 Adding New Collection Lists

/// 创建PHCollectionList
///
/// - parameter title : PHCollectionList名
///
/// - returns: PHCollectionListChangeRequest
public class func creationRequestForAssetCollectionWithTitle(title: String) -> Self

/// 新创建的PHCollectionList
public var placeholderForCreatedAssetCollection: PHObjectPlaceholder { get }

2 Deleting Collection Lists

/// 删除PHCollectionList
///
/// - parameter collectionLists : [PHCollectionList]
///
/// - returns: void
public class func deleteCollectionLists(collectionLists: NSFastEnumeration)

3 Modifying Collection Lists

/// 通过PHCollectionList初始化PHCollectionListChangeRequest
 public convenience init?(forCollectionList collectionList: PHCollectionList)

/// 初始化使用PHFetchResult替换PHCollectionList内部数据
public convenience init?(forCollectionList collectionList: PHCollectionList, childCollections: PHFetchResult)

/// 集合名
public var title: String

// A PHCollection can only belong to a single parent PHCollection
/// 增加[PHCollection]
public func addChildCollections(collections: NSFastEnumeration)
/// 插入[PHCollection]
public func insertChildCollections(collections: NSFastEnumeration, atIndexes indexes: NSIndexSet)
/// 删除[PHCollection]
public func removeChildCollections(collections: NSFastEnumeration)
/// 删除指定位置的[PHCollection]
public func removeChildCollectionsAtIndexes(indexes: NSIndexSet)
/// 替换指定位置的[PHCollection]
public func replaceChildCollectionsAtIndexes(indexes: NSIndexSet, withChildCollections collections: NSFastEnumeration)

/// 移动PHCollectionList内部数据
public func moveChildCollectionsAtIndexes(indexes: NSIndexSet, toIndex: Int)

 


其他

源代码

Swift

参考资料

Photos Framework Reference

PHAssetCreationRequest Class Reference

文档修改记录

时间描述
2016-01-07博文完成

版权所有

优快云:http://blog.youkuaiyun.com/y550918116j

GitHub:https://github.com/937447974/Blog

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值