久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <tfoot id='6CFFZ'></tfoot>
    • <bdo id='6CFFZ'></bdo><ul id='6CFFZ'></ul>

    <small id='6CFFZ'></small><noframes id='6CFFZ'>

  1. <legend id='6CFFZ'><style id='6CFFZ'><dir id='6CFFZ'><q id='6CFFZ'></q></dir></style></legend>

    <i id='6CFFZ'><tr id='6CFFZ'><dt id='6CFFZ'><q id='6CFFZ'><span id='6CFFZ'><b id='6CFFZ'><form id='6CFFZ'><ins id='6CFFZ'></ins><ul id='6CFFZ'></ul><sub id='6CFFZ'></sub></form><legend id='6CFFZ'></legend><bdo id='6CFFZ'><pre id='6CFFZ'><center id='6CFFZ'></center></pre></bdo></b><th id='6CFFZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6CFFZ'><tfoot id='6CFFZ'></tfoot><dl id='6CFFZ'><fieldset id='6CFFZ'></fieldset></dl></div>
    1. 帶有 OK 和 Cancel 的 Swift 警報視圖:點擊了哪個按鈕

      Swift alert view with OK and Cancel: which button tapped?(帶有 OK 和 Cancel 的 Swift 警報視圖:點擊了哪個按鈕?)

        • <bdo id='v4JAn'></bdo><ul id='v4JAn'></ul>
        • <legend id='v4JAn'><style id='v4JAn'><dir id='v4JAn'><q id='v4JAn'></q></dir></style></legend>

          <small id='v4JAn'></small><noframes id='v4JAn'>

              <tbody id='v4JAn'></tbody>

              • <i id='v4JAn'><tr id='v4JAn'><dt id='v4JAn'><q id='v4JAn'><span id='v4JAn'><b id='v4JAn'><form id='v4JAn'><ins id='v4JAn'></ins><ul id='v4JAn'></ul><sub id='v4JAn'></sub></form><legend id='v4JAn'></legend><bdo id='v4JAn'><pre id='v4JAn'><center id='v4JAn'></center></pre></bdo></b><th id='v4JAn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='v4JAn'><tfoot id='v4JAn'></tfoot><dl id='v4JAn'><fieldset id='v4JAn'></fieldset></dl></div>
                <tfoot id='v4JAn'></tfoot>
              • 本文介紹了帶有 OK 和 Cancel 的 Swift 警報視圖:點擊了哪個按鈕?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我在 Xcode 中有一個用 Swift 編寫的警報視圖,我想確定用戶選擇了哪個按鈕(它是一個確認對話框)什么都不做或執行什么.

                I have an alert view in Xcode written in Swift and I'd like to determine which button the user selected (it is a confirmation dialog) to do nothing or to execute something.

                目前我有:

                @IBAction func pushedRefresh(sender: AnyObject) {
                    var refreshAlert = UIAlertView()
                    refreshAlert.title = "Refresh?"
                    refreshAlert.message = "All data will be lost."
                    refreshAlert.addButtonWithTitle("Cancel")
                    refreshAlert.addButtonWithTitle("OK")
                    refreshAlert.show()
                }
                

                我可能用錯了按鈕,請糾正我,因為這對我來說是全新的.

                I'm probably using the buttons wrong, please do correct me since this is all new for me.

                推薦答案

                如果你使用的是 iOS8,你應該使用 UIAlertController — UIAlertView 是 已棄用.

                If you are using iOS8, you should be using UIAlertController — UIAlertView is deprecated.

                這是一個如何使用它的示例:

                Here is an example of how to use it:

                var refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertControllerStyle.Alert)
                
                refreshAlert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { (action: UIAlertAction!) in
                  print("Handle Ok logic here")
                  }))
                
                refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action: UIAlertAction!) in
                  print("Handle Cancel Logic here")
                  }))
                
                presentViewController(refreshAlert, animated: true, completion: nil)
                

                您可以看到 UIAlertAction 的塊處理程序處理按鈕按下.一個很棒的教程在這里(盡管本教程不是使用 swift 編寫的):http://hayageek.com/uialertcontroller-example-ios/

                As you can see the block handlers for the UIAlertAction handle the button presses. A great tutorial is here (although this tutorial is not written using swift): http://hayageek.com/uialertcontroller-example-ios/

                Swift 3 更新:

                let refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertControllerStyle.alert)
                
                refreshAlert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action: UIAlertAction!) in
                    print("Handle Ok logic here")
                }))
                
                refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in
                    print("Handle Cancel Logic here")
                }))
                
                present(refreshAlert, animated: true, completion: nil)
                

                Swift 5 更新:

                let refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertControllerStyle.alert)
                
                refreshAlert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action: UIAlertAction!) in
                      print("Handle Ok logic here")
                }))
                
                refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in
                      print("Handle Cancel Logic here")
                }))
                
                present(refreshAlert, animated: true, completion: nil)
                

                Swift 5.3 更新:

                let refreshAlert = UIAlertController(title: "Refresh", message: "All data will be lost.", preferredStyle: UIAlertController.Style.alert)
                
                refreshAlert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action: UIAlertAction!) in
                      print("Handle Ok logic here")
                }))
                
                refreshAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action: UIAlertAction!) in
                      print("Handle Cancel Logic here")
                }))
                
                present(refreshAlert, animated: true, completion: nil)
                

                這篇關于帶有 OK 和 Cancel 的 Swift 警報視圖:點擊了哪個按鈕?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Swift: Geofencing / geolocations near user location(Swift:用戶位置附近的地理圍欄/地理位置)
                Fix Cordova Geolocation Ask for Location Message(修復 Cordova Geolocation 請求位置消息)
                respondsToSelector fails for appearance proxy(respondsToSelector 外觀代理失敗)
                symbol(s) not found for architecture armv7 (when running Archive in Xcode and Python3)(未找到架構 armv7 的符號(在 Xcode 和 Python3 中運行存檔時))
                I get quot;xcrun: error: SDK quot;iphonesimulatorquot; cannot be locatedquot; when running the toolchain(我得到“xcrun:錯誤:SDK“iphonesimulator;無法定位運行工具鏈時)
                Swift Extension: same extension function in two Modules(Swift 擴展:兩個模塊中的相同擴展功能)
                  <legend id='i9cYP'><style id='i9cYP'><dir id='i9cYP'><q id='i9cYP'></q></dir></style></legend>
                • <i id='i9cYP'><tr id='i9cYP'><dt id='i9cYP'><q id='i9cYP'><span id='i9cYP'><b id='i9cYP'><form id='i9cYP'><ins id='i9cYP'></ins><ul id='i9cYP'></ul><sub id='i9cYP'></sub></form><legend id='i9cYP'></legend><bdo id='i9cYP'><pre id='i9cYP'><center id='i9cYP'></center></pre></bdo></b><th id='i9cYP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='i9cYP'><tfoot id='i9cYP'></tfoot><dl id='i9cYP'><fieldset id='i9cYP'></fieldset></dl></div>

                • <tfoot id='i9cYP'></tfoot>
                    <tbody id='i9cYP'></tbody>

                  <small id='i9cYP'></small><noframes id='i9cYP'>

                    • <bdo id='i9cYP'></bdo><ul id='i9cYP'></ul>

                        • 主站蜘蛛池模板: 精品国产女人 | 午夜影院操 | 日韩免费福利视频 | 国产农村妇女精品一区 | 欧美日韩国产在线观看 | 91在线免费视频 | 国产亚洲网站 | 成人精品一区二区 | 精品国产青草久久久久福利 | 国产精品女人久久久 | 免费一看一级毛片 | 亚洲精品一区二区三区蜜桃久 | 国产一区二区三区 | 香蕉一区 | 我爱操| 国产日韩久久 | 夜夜骑首页 | 国产精品一区二区三区四区五区 | 久久欧美精品 | 人人干视频在线 | 中国黄色在线视频 | 高清视频一区二区三区 | 天天夜碰日日摸日日澡 | 免费的av网站 | 九九热免费看 | 国产在线视频一区二区 | 成人羞羞国产免费视频 | 国产综合一区二区 | 中文字幕日本一区二区 | 欧美日韩久久久 | 日韩av免费在线电影 | 国产精品成av人在线视午夜片 | 久久久久久久久久久蜜桃 | 国产三级网站 | 亚洲成人一二三 | 中文字幕1区2区3区 日韩在线视频免费观看 | 成人性视频免费网站 | 中文字幕一区二区三区四区五区 | 影音先锋男| 日操夜操 | 中文字幕第九页 |