最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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)文章

最新評(píng)論

舒兰市| 兰西县| 巫溪县| 房产| 沅江市| 琼结县| 溧阳市| 张家港市| 玛沁县| 佛学| 鄂托克前旗| 潍坊市| 灵宝市| 广汉市| 奉节县| 济源市| 牙克石市| 新昌县| 四平市| 和平区| 库尔勒市| 伊通| 石首市| 北辰区| 醴陵市| 台安县| 邯郸市| 龙岩市| 丁青县| 太湖县| 聂拉木县| 西畴县| 民权县| 东丽区| 永新县| 民丰县| 株洲市| 韶关市| 元氏县| 吕梁市| 石台县|