91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

嘉峪关市| 柳河县| 赤城县| 丹江口市| 上饶市| 泰州市| 古交市| 水富县| 凤阳县| 朔州市| 建瓯市| 灵台县| 鄂温| 巴林左旗| 文化| 四子王旗| 婺源县| 新泰市| 茶陵县| 大悟县| 安陆市| 卢氏县| 建湖县| 乐清市| 黑山县| 和硕县| 淅川县| 白山市| 美姑县| 文登市| 宣武区| 洛阳市| 甘孜| 枝江市| 开原市| 盐津县| 辽中县| 武定县| 锡林浩特市| 织金县| 巴林左旗|