首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ActionSheet滞后

ActionSheet滞后
EN

Stack Overflow用户
提问于 2017-08-31 13:22:42
回答 1查看 327关注 0票数 0

我有ActionSheet的代码,它的连接速度有点慢吗?

代码语言:javascript
复制
@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)
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-31 13:25:49

改变animated: true

代码语言:javascript
复制
present(actionSheetController, animated: true, completion: nil)

animated: false,以省略延迟或动画。

代码语言:javascript
复制
present(actionSheetController, animated: false, completion: nil)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45982535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档