[英]In UIKit, how do you present a confirmation dialog when the user is swiping to delete a table view cell?
Maybe UIAlertController .也许UIAlertController 。 You must present it on a UIViewController.
您必须将它呈现在 UIViewController 上。 Use actionSheet style for example.
例如使用 actionSheet 样式。
let alert = UIAlertController(
title: "Title",
message: "Message",
preferredStyle: .actionSheet
)
alert.addAction(UIAlertAction(
title: "Delete",
style: .destructive,
handler: { _ in
// delete action
}))
alert.addAction(UIAlertAction(
title: "Cancel",
style: .cancel,
handler: { _ in
// cancel action
}))
present(alert,
animated: true,
completion: nil
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.