gpt4 book ai didi

ios - 在 iPad 屏幕上按下 Controller 两次

转载 作者:行者123 更新时间:2023-11-30 12:02:03 25 4
gpt4 key购买 nike

我试图通过单击操作表上显示的选项之一来连接到另一个 Controller 。它在 iPhone 屏幕上运行良好,并且正在推送到适当的场景,但在 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)})

从 iPhone 推送时,我在控制台中收到此警告:

pushViewController:animated: called on <UINavigationController 
0x7fd96a81f800> while an existing transition or presentation is
occurring; the navigation stack will not be updated.

当我从 iPad 触发操作时,这不会显示,但新 Controller 堆叠在顶部。 FirstController , SecondController 单击上一屏幕中的 getRecipe/Login 按钮后。

最佳答案

您可以尝试从另一个操作执行转场

OperationQueue.main.addOperation {   
self.performSegue(withIdentifier: "GetRecipeID", sender: nil)
}

关于ios - 在 iPad 屏幕上按下 Controller 两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47095877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com