亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

IOS數字鍵盤左下角添加完成按鈕的實現方法

發布時間:2020-10-07 04:46:28 來源:腳本之家 閱讀:354 作者:lqh 欄目:移動開發

IOS數字鍵盤左下角添加完成按鈕的實現方法

實現代碼:

- (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數字鍵盤左下角添加完成按鈕的實現方法,如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

佳木斯市| 梅州市| 沾益县| 长阳| 鄂州市| 左云县| 宜章县| 江川县| 雷波县| 共和县| 栾川县| 芮城县| 双流县| 五常市| 正宁县| 兰西县| 林周县| 浑源县| 衡阳市| 固原市| 望奎县| 罗山县| 鄯善县| 四会市| 永兴县| 金秀| 收藏| 东港市| 普陀区| 贵溪市| 肇源县| 锡林郭勒盟| 大冶市| 余姚市| 鄂伦春自治旗| 江都市| 元氏县| 乌兰浩特市| 永修县| 佛冈县| 鄂伦春自治旗|