我想用swift實現彈出式模式。我必須實現這樣的功能,以便根據用戶點擊的響應(是/否)再彈出一個窗口。如何實現這個 ? 任何幫助將非常有幫助。Modal在Swift中彈出3
1
A
回答
4
UIAlertController專爲此目的而設計。
let alertController = UIAlertController(title: "Default AlertController", message: "A standard alert", preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "No", style: .Cancel) { (action:UIAlertAction!) in
println("you have pressed the No button");
//Call another alert here
}
alertController.addAction(cancelAction)
let OKAction = UIAlertAction(title: "Yes", style: .Default) { (action:UIAlertAction!) in
println("you have pressed Yes button");
//Call another alert here
}
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true, completion:nil)
+0
我知道這個報告控制,但情況是我必須做出一個自定義模式彈出,我怎麼能實現定製彈出? – victorious
+1
簡單的做法是,將UIView放入透明背景。在其上添加一個視圖,用作彈出窗口。現在開始設計UIView。 –
+0
好的,這似乎是一個更好的方法。我一定會實現。謝謝:) – victorious
相關問題
- 1. Modal在Angular2中彈出
- 2. 彈出UIPickerview爲SWIFT 3
- 3. Modal在JavaScript中彈出不起作用
- 4. 在Swift中彈出視圖
- 5. Swift 3:關閉彈出窗口ViewController
- 6. Bootstrap Modal不會彈出
- 7. Modal彈出複選框
- 8. Modal Popup Transition - 彈出按鈕?
- 9. Modal彈出後的Page_Load
- 10. 如何讓window.open彈出Modal?
- 11. Modal在Swift中查看
- 12. Modal在IE7中彈出工作正常,但在IE8中沒有彈出
- 13. Modal彈出AJAX退出時刷新
- 14. 在彈出的Swift中的TableView
- 15. Bootstrap-modal彈出窗口頂部閃爍
- 16. Modal彈出AJAX擴展按鈕保存
- 17. 如何使用Modal彈出Material Design Lite?
- 18. Bootstrap Modal彈出窗口不顯示
- 19. Bootstrap 3 modal change
- 20. bootstrap 3 modal,cropperjs
- 21. Scroll Bootstrap 3 modal
- 22. mvc 3彈出框3
- 23. 使用Modal在joomla中無法關閉彈出窗口
- 24. Modal在ASP.NET MVC 4中彈出不起作用
- 25. 在Swift 3中解析JSON時出錯
- 26. 自動完成出現在Modal彈出框後
- 27. jQuery Datepicker在Twitter Bootstrap 3 Modal
- 28. 在Angularjs的html5mode中使用Bootstrap 3 modal
- 29. Bootstrap 3 Modal在Mozilla中沒有顯示
- 30. 下滑彈出OS X Swift
檢查這個庫可以幫助它https://github.com/MarioIannotta/MIBlurPopup –