码迷,mamicode.com
首页 > 移动开发 > 详细

ios 键盘追加完成按钮

时间:2017-09-19 17:58:26      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:inpu   eve   orm   col   top   按钮   hba   ini   make   

//键盘追加完成按钮
UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 30)];
[topView setBarStyle:UIBarStyleDefault];
UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(2, 10, 50, 25);
[btn addTarget:self action:@selector(dismissKeyBoard) forControlEvents:UIControlEventTouchUpInside];
[btn setTitle:@"完成"forState:UIControlStateNormal];

[btn setTitleColor:[UIColor colorWithRed:31.0/255.0 green:112.0/255.0 blue:175.0/255.0 alpha:1.0] forState:UIControlStateNormal];

btn.titleLabel.textColor=[UIColor redColor];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc]initWithCustomView:btn];
NSArray * buttonsArray = [NSArray arrayWithObjects:btnSpace,doneBtn,nil];
[topView setItems:buttonsArray];
[_texTest setInputAccessoryView:topView];
}

ios 键盘追加完成按钮

标签:inpu   eve   orm   col   top   按钮   hba   ini   make   

原文地址:http://www.cnblogs.com/lanmaokomi/p/7552647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!