第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用Swift觸摸任意位置以關(guān)閉iOS鍵盤

使用Swift觸摸任意位置以關(guān)閉iOS鍵盤

素胚勾勒不出你 2019-11-03 17:04:26
我一直在尋找這個,但似乎找不到。我知道如何使用來關(guān)閉鍵盤,Objective-C但是我不知道如何使用Swift?有人知道嗎?
查看完整描述

3 回答

?
白衣非少年

TA貢獻1155條經(jīng)驗 獲得超0個贊

有關(guān)以下有關(guān)如何使用Swift在Xcode 6.1中關(guān)閉鍵盤的問題的答案:


import UIKit


class ItemViewController: UIViewController, UITextFieldDelegate {


    @IBOutlet var textFieldItemName: UITextField!


    @IBOutlet var textFieldQt: UITextField!


    @IBOutlet var textFieldMoreInfo: UITextField!



    override func viewDidLoad() {

        super.viewDidLoad()


        textFieldItemName.delegate = self

        textFieldQt.delegate = self

        textFieldMoreInfo.delegate = self

    }


                       ...


    /**

     * Called when 'return' key pressed. return NO to ignore.

     */

    func textFieldShouldReturn(textField: UITextField) -> Bool {

        textField.resignFirstResponder()

        return true

    }



   /**

    * Called when the user click on the view (outside the UITextField).

    */

    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {

        self.view.endEditing(true)

    }


}



查看完整回答
反對 回復(fù) 2019-11-04
  • 3 回答
  • 0 關(guān)注
  • 424 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號