调用dismissViewControllerAnimated后调用viewDidLoad

时间:2016-08-12 07:52:35

标签: ios iphone swift uiimagepickercontroller

为什么在dismissViewControllerAnimated之后调用viewDidLoad方法。我正在使用BSImagePickerViewController进行多种图像选择。所以,在解除了再次调用gallery viewDidLoad方法之后。

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.  

    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
        // Put your code here

            self.setImage()
        })

    self.presentViewController(alertController, animated: true, completion: nil)
}

func setImage()
{
    // BSImagePicker

    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()
        }, 
}

为什么会发生这种情况我没有得到,我发现只有一个链接重新定位link  但对我没有帮助,它没有按要求工作。 请指导,谢谢。

更新

在BSImagePickerViewController类

中解雇的方法
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)
}

0 个答案:

没有答案