caoporm97国产在线视频|欧美性XXXXX精品|一本一道久久a久久精品综合开|精品久久久久久久久久久AⅤ|

<div id="so1d9"><em id="so1d9"></em></div>
<nobr id="so1d9"></nobr>
  • <dl id="so1d9"><ins id="so1d9"><menu id="so1d9"></menu></ins></dl>
  • <option id="so1d9"></option>

    <dl id="so1d9"></dl>
      <dl id="so1d9"><sup id="so1d9"></sup></dl>

    1. <option id="so1d9"></option><option id="so1d9"><sup id="so1d9"></sup></option>

      <sup id="so1d9"></sup>
    2. 十年專(zhuān)注于品牌網(wǎng)站建設 十余年專(zhuān)注于網(wǎng)站建設_小程序開(kāi)發(fā)_APP開(kāi)發(fā),低調、敢創(chuàng )新、有情懷!
      南昌百恒網(wǎng)絡(luò )微信公眾號 掃一掃關(guān)注
      小程序
      tel-icon全國服務(wù)熱線(xiàn):400-680-9298,0791-88117053
      掃一掃關(guān)注百恒網(wǎng)絡(luò )微信公眾號
      掃一掃打開(kāi)百恒網(wǎng)絡(luò )微信小程序

      百恒網(wǎng)絡(luò )

      南昌百恒網(wǎng)絡(luò )

      關(guān)閉和打開(kāi)鍵盤(pán)的通知使用方法

      百恒網(wǎng)絡(luò ) 2017-09-30 6139

      從事南昌APP開(kāi)發(fā)的技術(shù)人員都知道,在關(guān)閉和打開(kāi)鍵盤(pán)時(shí),iOS系統分別會(huì )發(fā)出如下廣播通知:UIKeyboardDidHideNotification和UIKeyboardDid- ShowNotification。使用廣播通知的時(shí)候,百恒網(wǎng)絡(luò )認為大家需要注意的是要在合適的時(shí)機注冊和解除通知,而ViewController中的有關(guān)代碼如下:

      override func viewWillAppear(animated: Bool) {

      super.viewWillAppear(animated)

      //注冊鍵盤(pán)出現通知

      NSNotificationCenter.defaultCenter().addObserver(self, selector:

      "keyboardDidShow:", name: UIKeyboardDidShowNotification,object: nil)

      //注冊鍵盤(pán)隱藏通知

      NSNotificationCenter.defaultCenter().addObserver(self, selector:

      "keyboardDidHide:", name: UIKeyboardDidHideNotification,object: nil)

      }

      override func viewWillDisappear(animated: Bool) {

      super.viewWillDisappear(animated)

      //解除鍵盤(pán)出現通知

      NSNotificationCenter.defaultCenter().removeObserver(self, name:UIKeyboardDidShowNotification, object: nil)

      //解除鍵盤(pán)隱藏通知

      NSNotificationCenter.defaultCenter().removeObserver(self, name:UIKeyboardDidHideNotification, object: nil)

      }

      func keyboardDidShow(notification: NSNotification) {

      NSLog("鍵盤(pán)打開(kāi)")

      }

      func keyboardDidHide(notification: NSNotification) {

      NSLog("鍵盤(pán)關(guān)閉")

      }

      -(void) viewWillAppear:(BOOL)animated {

      //注冊鍵盤(pán)出現通知

      [[NSNotificationCenter defaultCenter] addObserver:self

      selector:@selector (keyboardDidShow:)

      name: UIKeyboardDidShowNotification object:nil];

      //注冊鍵盤(pán)隱藏通知

      [[NSNotificationCenter defaultCenter] addObserver:self

      selector:@selector (keyboardDidHide:)

      name: UIKeyboardDidHideNotification object:nil];

      [super viewWillAppear:animated];

      }

      -(void) viewWillDisappear:(BOOL)animated {

      //解除鍵盤(pán)出現通知

      [[NSNotificationCenter defaultCenter] removeObserver:self

      name: UIKeyboardDidShowNotification object:nil];

      //解除鍵盤(pán)隱藏通知

      [[NSNotificationCenter defaultCenter] removeObserver:self

      name: UIKeyboardDidHideNotification object:nil];

      [super viewWillDisappear:animated];

      }

      -(void) keyboardDidShow: (NSNotification *)notif {

      NSLog(@"鍵盤(pán)打開(kāi)");

      }

      -(void) keyboardDidHide: (NSNotification *)notif {

      NSLog(@"鍵盤(pán)關(guān)閉");

      }

      南昌APP制作開(kāi)發(fā)公司-百恒網(wǎng)絡(luò )在此還要跟大家說(shuō)明的是,注冊通知在viewWillAppear:方法中進(jìn)行,解除通知在viewWillDisappear:方法中進(jìn)行。keyboardDidShow:消息是在鍵盤(pán)打開(kāi)時(shí)發(fā)出的,keyboardDidHide:消息是在鍵盤(pán)關(guān)閉時(shí)發(fā)出的。

      看完以上介紹后,大家是否對關(guān)于IOS中關(guān)閉和打開(kāi)鍵盤(pán)的通知使用方法有所了解了呢? 如果還有哪些不太明白的地方,可隨時(shí)來(lái)電和我們聯(lián)系,我們專(zhuān)業(yè)為您講解。此外,本公司專(zhuān)注于A(yíng)PP開(kāi)發(fā)、南昌做網(wǎng)站、微信開(kāi)發(fā)等方面的服務(wù),如有需要,百恒隨時(shí)為您效勞!


      400-680-9298,0791-88117053
      掃一掃關(guān)注百恒網(wǎng)絡(luò )微信公眾號
      掃一掃打開(kāi)百恒網(wǎng)絡(luò )小程序

      歡迎您的光顧,我們將竭誠為您服務(wù)×

      售前咨詢(xún) 售前咨詢(xún)
       
      售前咨詢(xún) 售前咨詢(xún)
       
      售前咨詢(xún) 售前咨詢(xún)
       
      售前咨詢(xún) 售前咨詢(xún)
       
      售前咨詢(xún) 售前咨詢(xún)
       
      售后服務(wù) 售后服務(wù)
       
      售后服務(wù) 售后服務(wù)
       
      備案專(zhuān)線(xiàn) 備案專(zhuān)線(xiàn)
       
      ×

      <div id="so1d9"><em id="so1d9"></em></div>
      <nobr id="so1d9"></nobr>
    3. <dl id="so1d9"><ins id="so1d9"><menu id="so1d9"></menu></ins></dl>
    4. <option id="so1d9"></option>

      <dl id="so1d9"></dl>
        <dl id="so1d9"><sup id="so1d9"></sup></dl>

      1. <option id="so1d9"></option><option id="so1d9"><sup id="so1d9"></sup></option>

        <sup id="so1d9"></sup>