Why is the viewDidLoad method called after the ViewControllerAnimated is rejected. I use BSImagePickerViewController for multiple image selection. So, after rejecting the viewDidLoad method of the gallery again.
override func viewDidLoad() {
super.viewDidLoad()
let alertController = UIAlertController(title: title, message: "Start by selecting the photos/videos you want to represent your room", preferredStyle: .Alert)
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default)
{ action -> Void in
self.setImage()
})
self.presentViewController(alertController, animated: true, completion: nil)
}
func setImage()
{
bs_presentImagePickerController(vc, animated: false,
select: { (asset: PHAsset) -> Void in
print("Selected: \(asset)")
}, deselect: { (asset: PHAsset) -> Void in
print("Deselected: \(asset)")
}, cancel: { (assets: [PHAsset]) -> Void in
print("Cancel: \(assets)")
}, finish: { (assets: [PHAsset]) -> Void in
print("Finish: \(assets)")
self.submit()
},
}
Why is this happening, I don’t get it, I found only one link that regresses this link but does not help me, it does not work as needed. Please help, thanks.
Update:
Rejection method, in the BSImagePickerViewController class
func doneButtonPressed(sender: UIBarButtonItem) {
guard let closure = finishClosure, let photosDataSource = photosDataSource else {
dismissViewControllerAnimated(true, completion: nil)
return
}
dispatch_async(dispatch_get_global_queue(0, 0), { () -> Void in
closure(assets: photosDataSource.selections)
})
dismissViewControllerAnimated(true, completion: nil)
}
source
share