回答編集履歴
3
追加。
answer
CHANGED
@@ -22,3 +22,11 @@
|
|
22
22
|
```
|
23
23
|
|
24
24
|
`PHFetchOptions`を使ったら、もう少し効率良く出来るかもしれませんが。
|
25
|
+
|
26
|
+
# 質問編集後の回答
|
27
|
+
|
28
|
+
```swift
|
29
|
+
self.photosImg = [image!]
|
30
|
+
```
|
31
|
+
|
32
|
+
上書きになっているので、追加にして下さい。
|
2
言い訳。
answer
CHANGED
@@ -20,3 +20,5 @@
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
```
|
23
|
+
|
24
|
+
`PHFetchOptions`を使ったら、もう少し効率良く出来るかもしれませんが。
|
1
コード追記。
answer
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
至急ということなのでとりあえず。
|
2
2
|
[(iOS8.1)PhotoKitで各種アルバムを取得する](http://qiita.com/takabosoft/items/cb3438f3762f1f59a5ef)
|
3
3
|
|
4
|
-
参考になれば。
|
4
|
+
参考になれば。
|
5
|
+
|
6
|
+
【追記】
|
7
|
+
|
8
|
+
```swift
|
9
|
+
let collections = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .albumRegular, options: nil)
|
10
|
+
collections.enumerateObjects { (collection: PHAssetCollection, index: Int, stop) in
|
11
|
+
print(index, collection)
|
12
|
+
if collection.localizedTitle == "hoge" { //アルバム名
|
13
|
+
let assets = PHAsset.fetchAssets(in: collection, options: nil)
|
14
|
+
assets.enumerateObjects({ (asset, index, stop) in
|
15
|
+
print(index, asset)
|
16
|
+
})
|
17
|
+
//stop.pointee = true //同じ名前のアルバムが複数存在出来るようなのでstopしない
|
18
|
+
} else {
|
19
|
+
print(index, "skip")
|
20
|
+
}
|
21
|
+
}
|
22
|
+
```
|