IOS数字键盘左下角添加完成按钮的实现方法

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:@" 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:@"

以上就是IOS数字键盘左下角添加完成按钮的实现方法,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!


分享名称:IOS数字键盘左下角添加完成按钮的实现方法
当前URL:http://csdahua.cn/article/gejgsh.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流