0
私はpresentViewControllerが最初のパラメータimagePickerControllerで何をするのか不思議です。私がimagePickerControllerのプロパティを割り当てた方法を考えると、presentViewControllerはすべての情報を使ってビューを表示しますか?presentViewControllerはビューをどのように表示しますか?
@IBAction func imageFromPhotoLibrary(sender: UITapGestureRecognizer) {
// Hide the keyboard.
myTextField.resignFirstResponder()
// UIImagePickerController is a view controller that lets a user pick media from their photo library.
let imagePickerController = UIImagePickerController()
// Only allow photos to be picked, not taken.
imagePickerController.sourceType = .PhotoLibrary
// Make sure ViewController is notified when the user picks an image.
imagePickerController.delegate = self
presentViewController(imagePickerController, animated: true, completion: nil)
}
よろしくお願いします。私のsourceTypeを.Cameraに変更した場合、presentViewControllerはimagePickerControllerによって与えられた情報を表示し、カメラを表示するようにビューを制御します。 –
ボタンを追加するだけのaddChild(ボタン)と似ていますが、その外観を表示する以外はボタンに何もしませんか? –