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

<tfoot id='L6hWD'></tfoot>

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

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

    2. <i id='L6hWD'><tr id='L6hWD'><dt id='L6hWD'><q id='L6hWD'><span id='L6hWD'><b id='L6hWD'><form id='L6hWD'><ins id='L6hWD'></ins><ul id='L6hWD'></ul><sub id='L6hWD'></sub></form><legend id='L6hWD'></legend><bdo id='L6hWD'><pre id='L6hWD'><center id='L6hWD'></center></pre></bdo></b><th id='L6hWD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='L6hWD'><tfoot id='L6hWD'></tfoot><dl id='L6hWD'><fieldset id='L6hWD'></fieldset></dl></div>

          <bdo id='L6hWD'></bdo><ul id='L6hWD'></ul>

        哪里可以找到關于 swift alert (UIAlertController) 的清

        Where to find a clear explanation about swift alert (UIAlertController)?(哪里可以找到關于 swift alert (UIAlertController) 的清晰解釋?)

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

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

              <i id='Dnwg6'><tr id='Dnwg6'><dt id='Dnwg6'><q id='Dnwg6'><span id='Dnwg6'><b id='Dnwg6'><form id='Dnwg6'><ins id='Dnwg6'></ins><ul id='Dnwg6'></ul><sub id='Dnwg6'></sub></form><legend id='Dnwg6'></legend><bdo id='Dnwg6'><pre id='Dnwg6'><center id='Dnwg6'></center></pre></bdo></b><th id='Dnwg6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Dnwg6'><tfoot id='Dnwg6'></tfoot><dl id='Dnwg6'><fieldset id='Dnwg6'></fieldset></dl></div>

                  <tbody id='Dnwg6'></tbody>
                • 本文介紹了哪里可以找到關于 swift alert (UIAlertController) 的清晰解釋?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  對此找不到清晰而翔實的解釋.

                  Couldn't find a clear and informative explanation for this.

                  推薦答案

                  在一個主題上搜索了一段時間后我沒有找到一個清晰的解釋,即使在它的類參考中UIAlertController 參考

                  After searching a while on a subject I didn't find a clear explanation , even in it's class reference UIAlertController Reference

                  沒關系,但對我來說不夠清楚.

                  It is ok, but not clear enough for me.

                  所以在收集了一些和平之后,我決定做出自己的解釋(希望對你有幫助)

                  So after collecting some peaces I decided to make my own explanation (Hope it helps)

                  就這樣吧:

                  1. UIAlertView 如所指出的那樣被棄用:Swift 中的 UIAlertView
                  2. UIAlertController 應該在 iOS8+ 中使用所以要先創建一個,我們需要實例化它,Constructor(init) 獲取 3 個參數:
                  1. UIAlertView is deprecated as pointed out : UIAlertView in Swift
                  2. UIAlertController should be used in iOS8+ so to create one first we need to instantiate it, the Constructor(init) gets 3 parameters:

                  2.1 title:String -> 顯示在警報對話框頂部的大粗體文本

                  2.1 title:String -> big-bold text to display on the top of alert's dialog box

                  2.2 message:String -> 較小的文本(幾乎可以解釋它的自身)

                  2.2 message:String -> smaller text (pretty much explains it's self)

                  2.3 prefferedStyle:UIAlertControllerStyle -> 定義對話框樣式,大多數情況下:UIAlertControllerStyle.Alert

                  2.3 prefferedStyle:UIAlertControllerStyle -> define the dialog box style, in most cases: UIAlertControllerStyle.Alert

                  1. 現在要實際向用戶展示它,我們可以使用 showViewControllerpresentViewController 并將我們的警報作為參數傳遞

                  1. Now to actually show it to the user, we can use showViewController or presentViewController and pass our alert as parameter

                  要添加一些與用戶的交互,我們可以使用:

                  To add some interaction with a user we can use:

                  4.1UIAlertController.addAction 創建按鈕

                  4.2UIAlertController.addTextField 創建文本字段

                  編輯說明:以下代碼示例,已針對 swift 3 語法進行了更新

                  Edit note: code examples below, updated for swift 3 syntax

                  示例 1:簡單對話框

                  @IBAction func alert1(sender: UIButton) {
                       //simple alert dialog
                      let alert=UIAlertController(title: "Alert 1", message: "One has won", preferredStyle: UIAlertControllerStyle.alert);
                      //show it
                      show(alert, sender: self);
                  }
                  

                  示例 2:帶有一個輸入 textField 的對話框 &兩個按鈕

                  Example 2: Dialog with one input textField & two buttons

                  @IBAction func alert2(sender: UIButton) {
                      //Dialog with one input textField & two buttons
                      let alert=UIAlertController(title: "Alert 2", message: "Two will win too", preferredStyle: UIAlertControllerStyle.alert);
                      //default input textField (no configuration...)
                      alert.addTextField(configurationHandler: nil);
                      //no event handler (just close dialog box)
                      alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.cancel, handler: nil));
                      //event handler with closure
                      alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.default, handler: {(action:UIAlertAction) in
                          let fields = alert.textFields!;
                          print("Yes we can: "+fields[0].text!);
                      }));
                      present(alert, animated: true, completion: nil);
                  }
                  

                  示例 3:一個自定義輸入 textField &一鍵

                  Example 3: One customized input textField & one button

                  @IBAction func alert3(sender: UIButton) {
                     // one input & one button
                     let alert=UIAlertController(title: "Alert 3", message: "Three will set me free", preferredStyle: UIAlertControllerStyle.alert);
                  
                      //configured input textField
                      var field:UITextField?;// operator ? because it's been initialized later
                      alert.addTextField(configurationHandler:{(input:UITextField)in
                          input.placeholder="I am displayed, when there is no value ;-)";
                          input.clearButtonMode=UITextFieldViewMode.whileEditing;
                          field=input;//assign to outside variable(for later reference)
                      });
                      //alert3 yesHandler -> defined in the same scope with alert, and passed as event handler later
                      func yesHandler(actionTarget: UIAlertAction){
                          print("YES -> !!");
                          //print text from 'field' which refer to relevant input now
                          print(field!.text!);//operator ! because it's Optional here
                      }
                      //event handler with predefined function
                      alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.default, handler: yesHandler));
                  
                      present(alert, animated: true, completion: nil);
                   }
                  

                  希望有幫助,祝你好運 ;-)

                  這篇關于哪里可以找到關于 swift alert (UIAlertController) 的清晰解釋?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  CLLocation returning negative speed(CLLocation 返回負速度)
                  Locations in Core Data sorted by distance via NSFetchedResultsController?(通過 NSFetchedResultsController 按距離排序的核心數據中的位置?)
                  Swift: Geofencing / geolocations near user location(Swift:用戶位置附近的地理圍欄/地理位置)
                  How to get Location (latitude amp; longitude value) in variable on iOS?(如何在 iOS 上的變量中獲取位置(緯度和經度值)?)
                  How to track the device location (iOS and Android) device using Phonegap(如何使用 Phonegap 跟蹤設備位置(iOS 和 Android)設備)
                  Easiest way of getting reverse geocoded current location from iOS(從 iOS 獲取反向地理編碼當前位置的最簡單方法)
                        <legend id='prTKw'><style id='prTKw'><dir id='prTKw'><q id='prTKw'></q></dir></style></legend>

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

                        <i id='prTKw'><tr id='prTKw'><dt id='prTKw'><q id='prTKw'><span id='prTKw'><b id='prTKw'><form id='prTKw'><ins id='prTKw'></ins><ul id='prTKw'></ul><sub id='prTKw'></sub></form><legend id='prTKw'></legend><bdo id='prTKw'><pre id='prTKw'><center id='prTKw'></center></pre></bdo></b><th id='prTKw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='prTKw'><tfoot id='prTKw'></tfoot><dl id='prTKw'><fieldset id='prTKw'></fieldset></dl></div>

                          <tbody id='prTKw'></tbody>
                        <tfoot id='prTKw'></tfoot>

                            <bdo id='prTKw'></bdo><ul id='prTKw'></ul>
                            主站蜘蛛池模板: 久久久久99| 亚洲精品在线免费观看视频 | 精品一区二区三区在线观看国产 | 国产一区二区三区色淫影院 | 一本一道久久a久久精品综合 | 在线观看你懂的网站 | 亚洲成人午夜电影 | 国产精品一区二区日韩 | 免费的av | 性色av香蕉一区二区 | 天堂色 | 99国产精品久久久 | 精品三区| 精品国产一区二区三区性色av | 91xxx在线观看 | 日日噜噜夜夜爽爽狠狠 | 精品国产一区久久 | 久久久久久久综合 | 欧美 日韩 国产 成人 在线 | 亚欧精品一区 | 黄色一级片视频 | 凹凸日日摸日日碰夜夜 | 国产福利二区 | 欧美日一区二区 | 国产欧美在线 | 国产一区二区三区在线视频 | 欧美一区二区三区四区视频 | 中文字幕在线免费观看 | 中文字幕一级毛片 | 亚洲国产精品久久久久婷婷老年 | 亚洲午夜精品 | 午夜精品| 欧美一区在线视频 | 中文字幕日韩欧美 | 国内精品久久久久久 | 在线中文字幕av | 亚洲一区不卡 | 亚洲成色777777在线观看影院 | 午夜在线 | 欧美久 | 亚洲最新在线 |