0
조치 시트에 제시된 옵션 중 하나를 클릭하여 다른 컨트롤러로 전환하려고합니다. 그것은 아이폰 화면에서 잘 작동하고 적절한 장면으로 푸시되고 있지만 문제는 iPad에서 발생합니다. 나는 비슷한 문제에 대해서 많은 것을 찾고 있었지만 성공하지 못했습니다.컨트롤러가 iPad 화면에서 두 번 푸시됩니다.
@IBAction func actionSheet(_ sender: UIButton) {
let alert = UIAlertController(title: "Please select one of the options", message: nil, preferredStyle: .actionSheet)
let cancelActionButton = UIAlertAction(title: "Cancel", style: .cancel) { action -> Void in }
let recipeActionButton = UIAlertAction(title: "Get The Recipe", style: .default) { action in self.performSegue(withIdentifier: "GetRecipeID", sender: self) }
let facebookActionButton = UIAlertAction(title: "Login with Facebook", style: .default) { action in self.handleCustomFacebookLogin() }
//actions
alert.addAction(cancelActionButton)
alert.addAction(recipeActionButton)
alert.addAction(facebookActionButton)
// support ipad
if let popoverController = alert.popoverPresentationController {
popoverController.sourceView = sender
popoverController.sourceRect = sender.bounds
}
self.present(alert, animated: true, completion: nil)
}
이 방법은 또한 작동하지 않습니다 : 아이폰에서 밀어 때
let viewController = UIStoryboard(name: "Detail", bundle: nil).instantiateViewController(withIdentifier: "DetailsVC") as! DetailsViewController
let recipeActionButton = UIAlertAction(title: "Get The Recipe", style: .default, handler: { action in
self.navigationController?.pushViewController(viewcontroller, animated: true)})
내가 콘솔에서이 경고를 받고 있습니다 :
pushViewController:animated: called on <UINavigationController
0x7fd96a81f800> while an existing transition or presentation is
occurring; the navigation stack will not be updated.
이 화면이 표시되지 않을 때 iPad에서 동작을 트리거하지만 새로운 컨트롤러가 맨 위에 쌓입니다. 이전 화면에서 getRecipe/Login 버튼을 클릭 한 후 FirstController, SecondController 을 입력하십시오.
내가이 안에 액션 통화를 보류해야합니까 다른 작업에서 SEGUE을 수행 할 수 있을까? – Vuko
예전과 같은 위치 – Retterdesdialogs
{Operation in OperationQueue.main.addOperation { self.performSegue (withIdentifier : "GetRecipeID", 발신자 : nil)}} 이것은 불행히도 아무 것도 변경하지 않습니다. – Vuko