gpt4 book ai didi

ios - UIAlertController popoverPresentationController 错误 : Snapshotting a view that has not been rendered results in an empty snapshot

转载 作者:搜寻专家 更新时间:2023-10-31 19:33:39 37 4
gpt4 key购买 nike

我有一个 UIBarButtonItem,它会打开一个像这样的弹出窗口:

@IBAction func openAdmin(sender: UIBarButtonItem) {
let alertController = UIAlertController(title: nil, message: "Elige una opción", preferredStyle: .ActionSheet)

// action button initializations... ... ...

alertController.popoverPresentationController?.sourceView = self.view
alertController.popoverPresentationController?.sourceRect = sender

presentViewController(alertController, animated: true, completion: nil)
}

当我使用该功能打开弹出窗口时,我收到了 4 次警告:

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

我需要做什么来解决这个警告?

我读了很多带有相同警告的问题,但这些问题是关于相机或涉及 UIImageView 的,但我既没有使用相机也没有使用 UIImageView。弹出框只有两个 UIAlertAction

最佳答案

你可以找到answer堆栈溢出中的类似问题。您所要做的就是在 presentViewController 之后调用 layoutIfNeeded。

presentViewController(alertController, animated: true, completion: nil)
[alertController.view layoutIfNeeded];

关于ios - UIAlertController popoverPresentationController 错误 : Snapshotting a view that has not been rendered results in an empty snapshot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38731012/

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