gpt4 book ai didi

ios - ActionSheet 滞后

转载 作者:行者123 更新时间:2023-11-28 15:21:08 27 4
gpt4 key购买 nike

我有 ActionSheet 的代码,它可以连接的东西有点慢?

@IBAction func showAction(_ sender: UIButton) {
let actionSheetController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
actionSheetController.addAction(
UIAlertAction(title: NSLocalizedString("Copy", comment: ""), style: .default, handler: { [weak self] _ in
guard let strongSelf = self else { return }

UIPasteboard.general.string = strongSelf.displayResultLabel.text

let alert = UIAlertController(title: NSLocalizedString("Copied to clipboard", comment: ""), message: "", preferredStyle: .alert)
let when = DispatchTime.now() + 0.5
DispatchQueue.main.asyncAfter(deadline: when){
alert.dismiss(animated: true, completion: nil)
}
self?.present(alert, animated: true, completion:nil)
})
)
actionSheetController.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil))

present(actionSheetController, animated: true, completion: nil)
}

最佳答案

更改 animated: true

present(actionSheetController, animated: true, completion: nil)

animated: false 省略延迟或动画

present(actionSheetController, animated: false, completion: nil)

关于ios - ActionSheet 滞后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45982535/

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