2017-08-31 6 views
0

ActionSheetのコードがありますが、接続できるのは少し遅いですか?ActionSheet lags

@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) 
} 
+0

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

- オン存在または却下 –

+0

@ Anbu.Karthikどちらか1つプレゼント – BLC

答えて

1

変化animated: true省略ためanimated: false遅延またはアニメーション、それが接続することができるものと少し遅い

present(actionSheetController, animated: false, completion: nil) 
関連する問題