ios定制键盘
2011-10-25 11:20
429 查看
注册键盘弹出消息:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
移除注册:
[[NSNotificationCenter defaultCenter] removeObserver:self];
获取键盘VIEW并添加自己的BUTTON:
- (void)keyboardWillShow:(NSNotification *)note { // create custom button UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom]; doneButton.frame = CGRectMake(0, 163, 106, 53); doneButton.adjustsImageWhenHighlighted = NO; [doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal]; [doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted]; [doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside]; // locate keyboard view UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1]; UIView* keyboard; for(int i=0; i<[tempWindow.subviews count]; i++) { keyboard = [tempWindow.subviews objectAtIndex:i]; // keyboard view found; add the custom button to it if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) [keyboard addSubview:doneButton]; } }
http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key
相关文章推荐
- iOS如何定制键盘
- IOS: iPhone键盘通知与键盘定制
- IOS: iPhone键盘通知与键盘定制
- iOS 键盘类型定制归纳 分类: ios开发 2015-04-02 12:58 347人阅读 评论(0) 收藏
- iOS 键盘类型定制归纳
- IOS: iPhone键盘通知与键盘定制
- 键盘定制iOS学习笔记9-软键盘的隐藏
- IOS: iPhone键盘通知与键盘定制
- ios 定制键盘
- [转]定制 iOS 键盘
- IOS: iPhone键盘通知与键盘定制
- 定制 iOS 键盘(转)
- IOS: iPhone键盘通知与键盘定制
- IOS: iPhone键盘通知与键盘定制
- IOS: iPhone键盘通知与键盘定制
- 解决ios局部滚动不流畅以及出界(黑)和键盘定制
- IOS: iPhone键盘通知与键盘定制
- IOS: iPhone键盘通知与键盘定制
- iOS中如何自定制键盘呢?
- iOS 键盘类型定制归纳