UIAlertController推送导航栏项

时间:2017-06-07 17:55:12

标签: swift uinavigationbar uialertcontroller

UIAlewrtController按下导航控制器中的按钮(见图)

执行顺序:

  1. on push +警报控制器已激活
  2. 选择"采取行动"或者"请求行动"视图控制器ActionDetialsVC已激活。
  3. 显示ActionDetialsVC
  4. on ActionDetialsVC已关闭
  5. iitial controlers BACK arrow move
  6. 将断点放在:

    1. self.present(alert,animated:true,completion:nil)
    2. 2个警报处理程序中的第一个Swift指令
    3. 这些断点之间可以看到奇怪的导航后退按钮行为。

      仅在我的视图中引入警报控制器时才会出现此问题!!!!!

      感谢您的帮助

      问题图片: enter image description here

      代码:

      func addPressed(_ sender: Any) {
      
          let alert = UIAlertController (title: "Add an Action", message: nil, preferredStyle: UIAlertControllerStyle.alert)
      
          let request = UIAlertAction (title: actionType.Request.Str(), style: UIAlertActionStyle.default, handler: {
              action in
      
              self.actionTypeTemp = actionType.Request.Str()
              self.performSegue(withIdentifier: "segueActionDetailsVC", sender: nil)
          }  )
      
          let take = UIAlertAction (title: actionType.Take.Str(), style: UIAlertActionStyle.default, handler: {
              action in
      
              self.actionTypeTemp = actionType.Take.Str()
              self.performSegue(withIdentifier: "segueActionDetailsVC", sender: nil)
          }  )
      
          let done = UIAlertAction (title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil )
      
          alert.addAction(request)
          alert.addAction(take)
          alert.addAction(done)
      
          self.present (alert, animated: true, completion: nil)
      }
      
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          if segue.identifier == "segueActionDetailsVC" {
              if let destination = segue.destination as? ActionDetailsVC {
                  if let action = sender as? PActions {
                      destination.actionToEdit = action
                  }
                  else {
                      if actionTypeTemp == actionType.Request.Str() {
                          destination.relatedContact = self.contact
                          destination.title = actionType.Request.Str()
                      }
                      else {
                          destination.relatedContact = self.contact
                          destination.title = actionType.Take.Str()
                      }
                  }
              }
          }
      }
      

0 个答案:

没有答案