Post

Replies

Boosts

Views

Activity

Comment on Taking a photo and displaying it on one of many UIImageView's
Hi Claude, I tried something to see the execution sequence. Please find as follows:- @IBAction func takeClientIdCardFrontPic() {         DispatchQueue.main.async {         let picker = UIImagePickerController()             picker.sourceType = .camera             picker.delegate = self             print("process 1")         self.present(picker, animated: true, completion: { self.clientIdCardFrontImage.image = self.imageTaken })             print("process 2")         }     } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {      picker.dismiss(animated: true, completion: nil)      guard let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage else { return }      imageTaken = image      print("process 3")  } The printed results were :- process 1 process 2 process 3 while they should be :- process 1 process 3 process 2 if they were going in sequence, despite that I used the DispatchQueue.main.async. I think if we figure out why its not waiting for me to take the picture the issue will be resolved
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’22
Comment on Taking a photo and displaying it on one of many UIImageView's
Hi Claude, Thanks a lot for your comment. I did try self.present(picker, animated: true, completion: { self.clientIdCardFrontImage.image = self.imageTaken }) but unfortunately the result is the same. I noticed something though, when I take the picture the first time, no picture is shown in the UIImageView, then I click again, the previous picture is shown. I think we're getting close, can you help me resolve this issue? Thanks a million PS: I'm really sorry I don't know how to format text like you showed me.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’22