国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

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

2020-07-26 02:43:07
字體:
來源:轉載
供稿:網友

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 原阳县| 邛崃市| 乌鲁木齐市| 新河县| 攀枝花市| 福建省| 孟津县| 庄河市| 潮安县| 平江县| 卓尼县| 林口县| 四子王旗| 泰和县| 四川省| 武定县| 长岭县| 伊金霍洛旗| 石嘴山市| 屏东市| 河东区| 襄城县| 永川市| 博兴县| 东乡| 徐州市| 玉山县| 普兰县| 时尚| 东乌珠穆沁旗| 富源县| 张家川| 麻江县| 五大连池市| 正阳县| 泸西县| 南丹县| 博白县| 博白县| 会同县| 巴东县|