dismissViewControllerAnimated does not work within a block

前端 未结 4 727
野趣味
野趣味 2021-01-02 04:36

I try to close a UIViewController after an UIAlertController has been shown.

This is my code:

UIAlertController *alertContr         


        
4条回答
  •  清酒与你
    2021-01-02 04:53

    [self dismissViewControllerAnimated:YES completion:nil] will close any view controllers that the currently displaying view (i.e., "self") is displaying. What you want to do is run this same method on the presenting view controller for "self". I.e.

    [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
    

提交回复
热议问题