私はのデータを持つUITableView
をいくつか持っています。私はタップにUIAlertController
を表示したいが、私は非常に奇妙な遅延を経験している。UITableViewでの警告の奇妙な遅延
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("tapped \(dispatcher.conversations[indexPath.row].name)") //this one works fine, no problems here
let message = dispatcher.conversations[indexPath.row].desc + "\n\nDo you wanna play this?"
let alertname = dispatcher.conversations[indexPath.row].name
let alert = UIAlertController(title: alertname, message: message, preferredStyle: .alert)
let actionOK = UIAlertAction(title: "Play", style: UIAlertActionStyle.default, handler: { (action) in
//play the file
})
let actionCancel = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: { (action) in
//cancel the file
})
alert.addAction(actionOK)
alert.addAction(actionCancel)
self.present(alert, animated: true, completion: {
//some code here
})
私の最初のアラートには若干の遅延がありますが、大部分はOKです。しかし、次のセルをタップしようとすると、アラートが表示されるまで数秒待たなければなりません。
私のデータへのアクセスに問題はないようですが(印刷はうまくいきますが)、何とかUIAlertControllerを表示するには数秒かかりました。
どうしたのですか?代わりに
あなたは、デバイスまたはシミュレータでテストしていますか? –
(両方とも同じ結果)。 – lithium
デバイスにプラグインなしで試すことができますか? –