如何检查剪贴板上是否有内容?
如果剪贴板上有内容,则执行某个操作,否则执行另一个操作(示例代码中已说明)
if (if in the clipboard, that is, then open the VC) {
let modalViewController = self.storyboard?.instantiateViewController(withIdentifier: "Clipboard") as? ClipboardViewController
modalViewController?.modalPresentationStyle = .overCurrentContext
self.present(modalViewController!, animated: true, completion: nil)
} else (if the clipboard is empty then) {
let alert = UIAlertController(title: "Clipboard is Empty", message: "It's recommended you bring your towel before continuing.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: nil))
alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
self.present(alert, animated: true)
}
UIPasteboard
的文档吗? - undefined