質問編集履歴

1

コードの変更点を追記

2019/05/28 01:37

投稿

yotubarail
yotubarail

スコア23

test CHANGED
File without changes
test CHANGED
@@ -319,3 +319,53 @@
319
319
 
320
320
 
321
321
  ```
322
+
323
+
324
+
325
+
326
+
327
+ 追記
328
+
329
+ private func selectImage()の部分を以下のように書き換えたところUIAleartControllerが立ち上がり、選択可能になりました。
330
+
331
+ ```Swift
332
+
333
+ コード
334
+
335
+ private func selectImage() {
336
+
337
+ let controller: UIAlertController = UIAlertController(title: "", message: "どの方法で写真を読み込みますか?", preferredStyle: UIAlertController.Style.actionSheet)
338
+
339
+
340
+
341
+ //1つ目の選択肢
342
+
343
+ controller.addAction(UIAlertAction(title: "写真を撮影する", style: UIAlertAction.Style.default, handler: {(action)in self.selectFromCamera()}))
344
+
345
+
346
+
347
+ //2つ目の選択肢
348
+
349
+ controller.addAction(UIAlertAction(title: "カメラロールから読み込む", style: UIAlertAction.Style.default, handler: { (action)in self.selectFromLibrary()}))
350
+
351
+
352
+
353
+
354
+
355
+ //キャンセルボタン
356
+
357
+ controller.addAction(UIAlertAction(title: "キャンセル", style: UIAlertAction.Style.cancel, handler: nil))
358
+
359
+
360
+
361
+ //UIAleartControllerを表示
362
+
363
+ self.present(controller, animated: true, completion: nil )
364
+
365
+ }
366
+
367
+ ```
368
+
369
+
370
+
371
+ しかし、選択できても送信できずにいます。