質問編集履歴

1

該当コードの追加

2020/05/06 07:42

投稿

Y.Kame
Y.Kame

スコア13

test CHANGED
File without changes
test CHANGED
@@ -38,6 +38,94 @@
38
38
 
39
39
 
40
40
 
41
+ ```ここに言語を入力
42
+
43
+
44
+
45
+ @IBAction func CreateAlbumButton(_ sender: Any) {
46
+
47
+
48
+
49
+ let dialog = UIAlertController(title: "アルバムの作成", message: nil, preferredStyle: .actionSheet)
50
+
51
+ dialog.addAction(UIAlertAction(title: "キャンセル", style: .cancel, handler: nil))
52
+
53
+ dialog.addAction(UIAlertAction(title: "フォトライブラリから選択", style: .default) { (action) in
54
+
55
+
56
+
57
+ if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) == true {
58
+
59
+
60
+
61
+
62
+
63
+ let pickerController = DKImagePickerController()
64
+
65
+ pickerController.maxSelectableCount = 20 //選択可能枚数をセット
66
+
67
+ pickerController.sourceType = .photo //モードをライブラリモードに設定(/camera)
68
+
69
+ pickerController.showsCancelButton = true //キャンセルボタンを有効化
70
+
71
+ pickerController.assetType = .allPhotos
72
+
73
+ pickerController.didSelectAssets = { [unowned self] (assets: [DKAsset]) in
74
+
75
+
76
+
77
+
78
+
79
+ for asset in assets {
80
+
81
+
82
+
83
+ asset.fetchFullScreenImage(completeBlock: { (image, info) in
84
+
85
+ self.albumimages.append(image!)
86
+
87
+ print("画像をalbumimagesに格納")
88
+
89
+ self.performSegue(withIdentifier: "goSecond", sender: nil)
90
+
91
+
92
+
93
+ })
94
+
95
+
96
+
97
+ }
98
+
99
+
100
+
101
+
102
+
103
+ }
104
+
105
+
106
+
107
+ self.present(pickerController, animated: true){}
108
+
109
+ }
110
+
111
+
112
+
113
+ })
114
+
115
+
116
+
117
+
118
+
119
+ self.present(dialog, animated: true, completion: nil) //ダイアログを表示
120
+
121
+
122
+
123
+ }
124
+
125
+ ```
126
+
127
+
128
+
41
129
 
42
130
 
43
131
  ### 補足情報(FW/ツールのバージョンなど)