{"id":173,"date":"2016-01-22T16:33:28","date_gmt":"2016-01-22T08:33:28","guid":{"rendered":"http:\/\/www.zhuyanbin.com\/?p=173"},"modified":"2016-01-22T16:33:28","modified_gmt":"2016-01-22T08:33:28","slug":"ios%e8%8e%b7%e5%8f%96%e6%8c%87%e5%ae%9a%e7%b1%bb%e5%9e%8b%e7%9b%b8%e5%86%8c","status":"publish","type":"post","link":"https:\/\/www.yanbin888.com\/?p=173","title":{"rendered":"IOS\u83b7\u53d6\u6307\u5b9a\u7c7b\u578b\u76f8\u518c"},"content":{"rendered":"<p>\u901a\u8fc7<code>PHAssetCollection<\/code>\u7684\u4ee5\u4e0b\u65b9\u6cd5\u6765\u83b7\u53d6\u6307\u5b9a\u7684\u76f8\u518c:<\/p>\n<pre class=\"hljs swift\"><code class=\"swift\"><span class=\"hljs-func\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-title\">fetchAssetCollectionsWithType<\/span><span class=\"hljs-params\">(<span class=\"hljs-number\">_<\/span> type: PHAssetCollectionType, subtype subtype: PHAssetCollectionSubtype, options options: PHFetchOptions?)<\/span><\/span> -&gt; <span class=\"hljs-type\">PHFetchResult<\/span><\/code><\/pre>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u9700\u8981\u81f3\u5c11\u6307\u5b9a\u4e24\u4e2a\u53c2\u6570\uff1a<\/p>\n<pre class=\"hljs swift\"><code class=\"swift\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">enum<\/span> <span class=\"hljs-title\">PHAssetCollectionType<\/span> : <span class=\"hljs-title\">Int<\/span> <\/span>{\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">Album<\/span> <span class=\"hljs-comment\">\/\/\u4ece iTunes \u540c\u6b65\u6765\u7684\u76f8\u518c\uff0c\u4ee5\u53ca\u7528\u6237\u5728 Photos \u4e2d\u81ea\u5df1\u5efa\u7acb\u7684\u76f8\u518c<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbum<\/span> <span class=\"hljs-comment\">\/\/\u7ecf\u7531\u76f8\u673a\u5f97\u6765\u7684\u76f8\u518c<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">Moment<\/span> <span class=\"hljs-comment\">\/\/Photos \u4e3a\u6211\u4eec\u81ea\u52a8\u751f\u6210\u7684\u65f6\u95f4\u5206\u7ec4\u7684\u76f8\u518c<\/span>\r\n}\r\n\r\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">enum<\/span> <span class=\"hljs-title\">PHAssetCollectionSubtype<\/span> : <span class=\"hljs-title\">Int<\/span> <\/span>{\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumRegular<\/span> <span class=\"hljs-comment\">\/\/\u7528\u6237\u5728 Photos \u4e2d\u521b\u5efa\u7684\u76f8\u518c\uff0c\u4e5f\u5c31\u662f\u6211\u6240\u8c13\u7684\u903b\u8f91\u76f8\u518c<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumSyncedEvent<\/span> <span class=\"hljs-comment\">\/\/\u4f7f\u7528 iTunes \u4ece Photos \u7167\u7247\u5e93\u6216\u8005 iPhoto \u7167\u7247\u5e93\u540c\u6b65\u8fc7\u6765\u7684\u4e8b\u4ef6\u3002\u7136\u800c\uff0c\u5728iTunes 12 \u4ee5\u53caiOS 9.0 beta4\u4e0a\uff0c\u9009\u7528\u8be5\u7c7b\u578b\u6ca1\u6cd5\u83b7\u53d6\u540c\u6b65\u7684\u4e8b\u4ef6\u76f8\u518c\uff0c\u800c\u5fc5\u987b\u4f7f\u7528AlbumSyncedAlbum\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumSyncedFaces<\/span> <span class=\"hljs-comment\">\/\/\u4f7f\u7528 iTunes \u4ece Photos \u7167\u7247\u5e93\u6216\u8005 iPhoto \u7167\u7247\u5e93\u540c\u6b65\u7684\u4eba\u7269\u76f8\u518c\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumSyncedAlbum<\/span> <span class=\"hljs-comment\">\/\/\u505a\u4e86 AlbumSyncedEvent \u5e94\u8be5\u505a\u7684\u4e8b<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumImported<\/span> <span class=\"hljs-comment\">\/\/\u4ece\u76f8\u673a\u6216\u662f\u5916\u90e8\u5b58\u50a8\u5bfc\u5165\u7684\u76f8\u518c\uff0c\u5b8c\u5168\u6ca1\u6709\u8fd9\u65b9\u9762\u7684\u4f7f\u7528\u7ecf\u9a8c\uff0c\u6ca1\u6cd5\u9a8c\u8bc1\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumMyPhotoStream<\/span> <span class=\"hljs-comment\">\/\/\u7528\u6237\u7684 iCloud \u7167\u7247\u6d41<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">AlbumCloudShared<\/span> <span class=\"hljs-comment\">\/\/\u7528\u6237\u4f7f\u7528 iCloud \u5171\u4eab\u7684\u76f8\u518c<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumGeneric<\/span> <span class=\"hljs-comment\">\/\/\u6587\u6863\u89e3\u91ca\u4e3a\u975e\u7279\u6b8a\u7c7b\u578b\u7684\u76f8\u518c\uff0c\u4e3b\u8981\u5305\u62ec\u4ece iPhoto \u540c\u6b65\u8fc7\u6765\u7684\u76f8\u518c\u3002\u7531\u4e8e\u672c\u4eba\u7684 iPhoto \u5df2\u88ab Photos \u66ff\u4ee3\uff0c\u65e0\u6cd5\u9a8c\u8bc1\u3002\u4e0d\u8fc7\uff0c\u5728\u6211\u7684 iPad mini \u4e0a\u662f\u65e0\u6cd5\u83b7\u53d6\u7684\uff0c\u800c\u4e0b\u9762\u7c7b\u578b\u7684\u76f8\u518c\uff0c\u5c3d\u7ba1\u6ca1\u6709\u5305\u542b\u7167\u7247\u6216\u89c6\u9891\uff0c\u4f46\u80fd\u591f\u83b7\u53d6\u5230\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumPanoramas<\/span> <span class=\"hljs-comment\">\/\/\u76f8\u673a\u62cd\u6444\u7684\u5168\u666f\u7167\u7247<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumVideos<\/span> <span class=\"hljs-comment\">\/\/\u76f8\u673a\u62cd\u6444\u7684\u89c6\u9891<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumFavorites<\/span> <span class=\"hljs-comment\">\/\/\u6536\u85cf\u6587\u4ef6\u5939<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumTimelapses<\/span> <span class=\"hljs-comment\">\/\/\u5ef6\u65f6\u89c6\u9891\u6587\u4ef6\u5939\uff0c\u540c\u65f6\u4e5f\u4f1a\u51fa\u73b0\u5728\u89c6\u9891\u6587\u4ef6\u5939\u4e2d<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumAllHidden<\/span> <span class=\"hljs-comment\">\/\/\u5305\u542b\u9690\u85cf\u7167\u7247\u6216\u89c6\u9891\u7684\u6587\u4ef6\u5939<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumRecentlyAdded<\/span> <span class=\"hljs-comment\">\/\/\u76f8\u673a\u8fd1\u671f\u62cd\u6444\u7684\u7167\u7247\u6216\u89c6\u9891<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumBursts<\/span> <span class=\"hljs-comment\">\/\/\u8fde\u62cd\u6a21\u5f0f\u62cd\u6444\u7684\u7167\u7247\uff0c\u5728 iPad mini \u4e0a\u6309\u4f4f\u5feb\u95e8\u4e0d\u653e\u5c31\u53ef\u4ee5\u4e86\uff0c\u4f46\u662f\u7167\u7247\u4f9d\u7136\u6ca1\u6709\u5b58\u653e\u5728\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e0b\uff0c\u800c\u662f\u5728\u76f8\u673a\u76f8\u518c\u91cc\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumSlomoVideos<\/span> <span class=\"hljs-comment\">\/\/Slomo \u662f slow motion \u7684\u7f29\u5199\uff0c\u9ad8\u901f\u6444\u5f71\u6162\u52a8\u4f5c\u89e3\u6790\uff0c\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0ciOS \u8bbe\u5907\u4ee5120\u5e27\u62cd\u6444\u3002\u4e0d\u8fc7\u6211\u7684 iPad mini \u4e0d\u652f\u6301\uff0c\u6ca1\u6cd5\u9a8c\u8bc1\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">SmartAlbumUserLibrary<\/span> <span class=\"hljs-comment\">\/\/\u8fd9\u4e2a\u547d\u540d\u6700\u795e\u5947\u4e86\uff0c\u5c31\u662f\u76f8\u673a\u76f8\u518c\uff0c\u6240\u6709\u76f8\u673a\u62cd\u6444\u7684\u7167\u7247\u6216\u89c6\u9891\u90fd\u4f1a\u51fa\u73b0\u5728\u8be5\u76f8\u518c\u4e2d\uff0c\u800c\u4e14\u4f7f\u7528\u5176\u4ed6\u5e94\u7528\u4fdd\u5b58\u7684\u7167\u7247\u4e5f\u4f1a\u51fa\u73b0\u5728\u8fd9\u91cc\u3002<\/span>\r\n    <span class=\"hljs-keyword\">case<\/span> <span class=\"hljs-type\">Any<\/span> <span class=\"hljs-comment\">\/\/\u5305\u542b\u6240\u6709\u7c7b\u578b<\/span>\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7PHAssetCollection\u7684\u4ee5\u4e0b\u65b9\u6cd5\u6765\u83b7\u53d6\u6307\u5b9a\u7684\u76f8\u518c: func fetchAssetCollec <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.yanbin888.com\/?p=173\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[30],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-ios","tag-ios"],"_links":{"self":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":1,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yanbin888.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}