카메라 나 imageGallery를 열기 위해이 두 개의 별도 버튼을 사용하고 있습니다. UIImagePickerController .savedPhotosAlbum 대신 .camera로 엽니 다.
@IBAction func tapGal(_ sender: Any) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.savedPhotosAlbum) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
imagePicker.allowsEditing = true
self.present(imagePicker, animated: true, completion: nil)
} else {
NSLog("No Cam Fam")
}
}
@IBAction func tapCam(_ sender: Any) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
imagePicker.allowsEditing = true
self.present(imagePicker, animated: true, completion: nil)
} else {
NSLog("No Cam Fam")
}
}
카메라 버튼은 카메라를 엽니 다 의미, 그냥 정상적으로 작동하고 있지만, 갤러리 버튼은 카메라를 열어 가고 있습니다. 갤러리 버튼이 실제로 tapGal
기능에 연결되어 있는지 확인하기 위해 다시 확인했습니다. 또한 .savedPhotosAlbum
을 .photoLibrary
으로 바꾸려고 시도했지만 그 결과는 같습니다.
제발 봐라. 통해 UR 코드. 두 개의'imagePicker.sourceType = ...'줄을보십시오. – rmaddy
코드가 동일하므로 결과가 동일합니다. –