Presenting a modal view controller immediately after dismissing another

后端 未结 8 1833
渐次进展
渐次进展 2020-12-02 12:59

I\'m dismissing a modal view controller and then immediately presenting another one, but the latter never happens. Here\'s the code:

 [self dismissModalViewContro         


        
8条回答
  •  天命终不由人
    2020-12-02 13:46

    In Swift:

    1. Use dismissViewController to dismiss the 1st presented view.
    2. Use dismissViewController's completion block to call a function in the mainVC. That function should call the second VC.

    Your dismissViewController should look like this:

    var presentingVC_Delegate: mainLists_PopoverDelegation!
    
    @IBAction fund button_Pressed (sender: AnyObject) {
        self.dismissViewControllerAnimated(true, completion: { finished in
            self.presentingVC_Delegate.presentOtherVC()
            print("DismissVC completion block says hello")
        })
    }
    

    Where the mainVC houses that presentOtherVC:

    func presentSettingsVC () {
        self.performSegueWithIdentifier("present_OtherVC", sender: nil)
    }
    

提交回复
热议问题