亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

IOS數(shù)字鍵盤左下角添加完成按鈕的實(shí)現(xiàn)方法

 更新時(shí)間:2017年08月24日 10:59:30   投稿:lqh  
這篇文章主要介紹了IOS數(shù)字鍵盤左下角添加完成按鈕的實(shí)現(xiàn)方法的相關(guān)資料,希望通過本文能實(shí)現(xiàn)類似這樣的功能,需要的朋友可以參考下

IOS數(shù)字鍵盤左下角添加完成按鈕的實(shí)現(xiàn)方法

實(shí)現(xiàn)代碼:

- (void)addDoneButtonToNumPadKeyboard 
{ 
  UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
  if (systemVersion < 8.0){ 
    doneButton.frame = CGRectMake(0, 163, 106, 53); 
  }else{ 
    doneButton.frame = CGRectMake(0, SCREEN_SIZE.height-53, 106, 53); 
  } 
  doneButton.tag = NUM_PAD_DONE_BUTTON_TAG; 
  doneButton.adjustsImageWhenHighlighted = NO; 
  [doneButton setTitle:@"完成" forState:UIControlStateNormal]; 
  [doneButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
  [doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside]; 
   
  NSArray *windowArr = [[UIApplication sharedApplication] windows]; 
  if (windowArr != nil && windowArr.count > 1){ 
    UIWindow *needWindow = [windowArr objectAtIndex:1]; 
    UIView *keyboard; 
    for(int i = 0; i < [needWindow.subviews count]; i++) { 
      keyboard = [needWindow.subviews objectAtIndex:i]; 
      NSLog(@"%@", [keyboard description]); 
      if(([[keyboard description] hasPrefix:@"<UIPeripheralHostView"] == YES) || ([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) || ([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES)){ 
         
        UIView *doneButtonView = [keyboard viewWithTag:NUM_PAD_DONE_BUTTON_TAG]; 
        if (doneButtonView == nil){ 
          [keyboard addSubview:doneButton]; 
        } 
      } 
    } 
  } 
} 
 
-(void)removeDoneButtonFromNumPadKeyboard 
{ 
  UIView *doneButton = nil; 
 
  NSArray *windowArr = [[UIApplication sharedApplication] windows]; 
  if (windowArr != nil && windowArr.count > 1){ 
    UIWindow *needWindow = [windowArr objectAtIndex:1]; 
    UIView *keyboard; 
    for(int i = 0; i < [needWindow.subviews count]; i++) { 
      keyboard = [needWindow.subviews objectAtIndex:i]; 
      if(([[keyboard description] hasPrefix:@"<UIPeripheralHostView"] == YES) || ([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) || ([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES)){ 
        doneButton = [keyboard viewWithTag:NUM_PAD_DONE_BUTTON_TAG]; 
        if (doneButton != nil){ 
          [doneButton removeFromSuperview]; 
        } 
      } 
    } 
  } 
} 


以上就是IOS數(shù)字鍵盤左下角添加完成按鈕的實(shí)現(xiàn)方法,如有疑問請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

  • iOS中設(shè)置圓角的幾種方法示例

    iOS中設(shè)置圓角的幾種方法示例

    這篇文章主要介紹了iOS中設(shè)置圓角的三種方法,其中包括使用layer屬性、使用繪圖設(shè)置圓角以及通過另一張mask圖創(chuàng)建新圖,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。
    2017-03-03
  • IOS 時(shí)間和時(shí)間戳之間轉(zhuǎn)化示例

    IOS 時(shí)間和時(shí)間戳之間轉(zhuǎn)化示例

    我們經(jīng)常從服務(wù)器后臺(tái)拿到時(shí)間戳的時(shí)間,以下代碼可以實(shí)現(xiàn)將時(shí)間戳轉(zhuǎn)為可讀的時(shí)間格式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2017-01-01
  • iOS簡(jiǎn)單登錄LoginViewController、注冊(cè)RegisterViewController等功能實(shí)現(xiàn)方法

    iOS簡(jiǎn)單登錄LoginViewController、注冊(cè)RegisterViewController等功能實(shí)現(xiàn)方法

    這篇文章主要為大家詳細(xì)介紹了iOS簡(jiǎn)單登錄LoginViewController、注冊(cè)RegisterViewController、UcenterViewController功能實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-09-09
  • iOS彈幕組件LNDanmakuMaster的具體使用

    iOS彈幕組件LNDanmakuMaster的具體使用

    這篇文章主要介紹了iOS彈幕組件LNDanmakuMaster的具體使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • iOS對(duì)數(shù)組進(jìn)行排序的實(shí)例代碼

    iOS對(duì)數(shù)組進(jìn)行排序的實(shí)例代碼

    本文通過實(shí)例代碼給大家講解了ios對(duì)數(shù)組進(jìn)行排序的實(shí)例方法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的的朋友參考下吧
    2017-08-08
  • iOS中從網(wǎng)絡(luò)獲取數(shù)據(jù)的幾種方法的比較

    iOS中從網(wǎng)絡(luò)獲取數(shù)據(jù)的幾種方法的比較

    IOS中獲取網(wǎng)絡(luò)數(shù)據(jù)一般有三種:1、NSURLCondition(已過時(shí)) 2、NSURLSession 3、三方庫(kù)AFNetWorking。下面通過本文給大家比較這三種方法的區(qū)別對(duì)比
    2017-11-11
  • iOS NSURLSessionDownloadTask設(shè)置代理文件下載的示例

    iOS NSURLSessionDownloadTask設(shè)置代理文件下載的示例

    本篇文章主要介紹了iOS NSURLSessionDownloadTask設(shè)置代理文件下載的示例,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • iOS中鍵盤 KeyBoard 上添加工具欄的方法

    iOS中鍵盤 KeyBoard 上添加工具欄的方法

    大iOS中 鍵盤 KeyBoard 上怎么添加工具欄呢?大致思路是提前創(chuàng)建好工具欄,在鍵盤彈出的時(shí)候?qū)⒐ぞ邫陲@示出來(lái),在鍵盤消失的時(shí)候讓工具欄隱藏。具體實(shí)現(xiàn)代碼大家參考下本文吧
    2017-08-08
  • IOS中各種手勢(shì)操作實(shí)例代碼

    IOS中各種手勢(shì)操作實(shí)例代碼

    IOS中手勢(shì)操作一般是 UIGestureRecognizer 類的幾個(gè)手勢(shì)子類去實(shí)現(xiàn),一般我們用到的手勢(shì)就這么5種,具體哪幾種大家通過本文學(xué)習(xí)吧,本文重點(diǎn)給大家介紹IOS中各種手勢(shì)操作實(shí)例代碼,一起看看吧
    2017-03-03
  • iOS實(shí)現(xiàn)文字轉(zhuǎn)化成彩色文字圖片

    iOS實(shí)現(xiàn)文字轉(zhuǎn)化成彩色文字圖片

    這篇文章主要為大家詳細(xì)介紹了iOS文字轉(zhuǎn)化成彩色文字圖片的實(shí)現(xiàn)方法,可以實(shí)現(xiàn)不同字體,漸變的效果,感興趣的小伙伴們可以參考一下
    2016-03-03

最新評(píng)論