How to allow user to pick the image with Swift?

后端 未结 21 800
[愿得一人]
[愿得一人] 2020-12-02 06:01

I am writing my first iOS application (iPhone only) with Swift. The main application view should allow user to choose the image from the photo gallery.

I\'ve found

21条回答
  •  醉梦人生
    2020-12-02 06:45

    Do this stuff for displaying photo library images swift coding:

    var pkcrviewUI = UIImagePickerController()
            if UIImagePickerController .isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary)
            {
                pkcrviewUI.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
                pkcrviewUI.allowsEditing = true
                pkcrviewUI.delegate = self
                [self .presentViewController(pkcrviewUI, animated: true , completion: nil)]
            }
    

提交回复
热议问题