iOS 给键盘上方添加 收回键盘的按钮
2016-11-04 15:54
267 查看
<p style="margin-top: 0px; margin-bottom: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span style="font-variant-ligatures: no-common-ligatures"> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa">UITextField</span><span style="font-variant-ligatures: no-common-ligatures"> * beiZhuTF;</span></p>
UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, DeviceWidth, 40)]; [topView setBarStyle:UIBarStyleDefault]; UIBarButtonItem * spaceBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; UIButton *doneBtn = [UIButton buttonWithType:UIButtonTypeSystem]; [doneBtn setTitle:@"收回键盘" forState:UIControlStateNormal]; doneBtn.frame = CGRectMake(2, 5, 80, 35); [doneBtn addTarget:self action:@selector(dealKeyboardHide) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *doneBtnItem = [[UIBarButtonItem alloc]initWithCustomView:doneBtn]; NSArray * buttonsArray = [NSArray arrayWithObjects:spaceBtn,doneBtnItem,nil]; [topView setItems:buttonsArray];
[beiZhuTF setInputAccessoryView:topView]; [beiZhuTF setAutocorrectionType:UITextAutocorrectionTypeNo]; [beiZhuTF setAutocapitalizationType:UITextAutocapitalizationTypeNone];
相关文章推荐
- ios在 键盘左下角添加“完成”按钮的实现原理
- iOS 键盘添加完成按钮,delegate和block回调
- ios在数字键盘左下角添加“完成”按钮的实现原理
- 在键盘上方添加取消按钮
- iOS中为导航栏的右上方添加各种按钮
- IOS数字键盘左下角添加完成按钮的实现方法
- iOS 为键盘添加隐藏按钮
- 为数字键盘添加自定义按钮的方法(iOS所有版本适用
- ios在数字键盘左下角添加“完成”按钮的实现原理
- ios 键盘右上角添加完成按钮
- iOS 自定义键盘收回按钮
- iOS开发- runtime基本用法解析和用runtime给键盘添加工具栏和按钮响应事件
- ios键盘上方添加view
- iOS-自定义textView键盘收回按钮
- ios隐藏数字键盘 --在数字键盘左下角添加“完成”按钮的实现原理
- iOS隐藏键盘————给iOS键盘添加收起(隐藏)按钮
- iOS 数字输入键盘添加一个完成按钮
- IOS开发UI篇之──键盘添加工具条
- iOS开发-收回键盘
- iOS开发 键盘添加工具条(toolbar)