teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

該当コードの追加

2020/05/06 07:42

投稿

Y.Kame
Y.Kame

スコア13

title CHANGED
File without changes
body CHANGED
@@ -18,7 +18,51 @@
18
18
  for-in(ループ)処理が終わったタイミングで遷移したいのですが、どこに書いたらいいのでしょうか・・・
19
19
 
20
20
 
21
+ ```ここに言語を入力
21
22
 
23
+ @IBAction func CreateAlbumButton(_ sender: Any) {
24
+
25
+ let dialog = UIAlertController(title: "アルバムの作成", message: nil, preferredStyle: .actionSheet)
26
+ dialog.addAction(UIAlertAction(title: "キャンセル", style: .cancel, handler: nil))
27
+ dialog.addAction(UIAlertAction(title: "フォトライブラリから選択", style: .default) { (action) in
28
+
29
+ if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) == true {
30
+
31
+
32
+ let pickerController = DKImagePickerController()
33
+ pickerController.maxSelectableCount = 20 //選択可能枚数をセット
34
+ pickerController.sourceType = .photo //モードをライブラリモードに設定(/camera)
35
+ pickerController.showsCancelButton = true //キャンセルボタンを有効化
36
+ pickerController.assetType = .allPhotos
37
+ pickerController.didSelectAssets = { [unowned self] (assets: [DKAsset]) in
38
+
39
+
40
+ for asset in assets {
41
+
42
+ asset.fetchFullScreenImage(completeBlock: { (image, info) in
43
+ self.albumimages.append(image!)
44
+ print("画像をalbumimagesに格納")
45
+ self.performSegue(withIdentifier: "goSecond", sender: nil)
46
+
47
+ })
48
+
49
+ }
50
+
51
+
52
+ }
53
+
54
+ self.present(pickerController, animated: true){}
55
+ }
56
+
57
+ })
58
+
59
+
60
+ self.present(dialog, animated: true, completion: nil) //ダイアログを表示
61
+
62
+ }
63
+ ```
64
+
65
+
22
66
  ### 補足情報(FW/ツールのバージョンなど)
23
67
 
24
68
  XCODE11