在数字键盘上添加button
来源:互联网 发布:大数据博士招生 编辑:程序博客网 时间:2024/04/27 20:53
//定义一个消息中心
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员 name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
[doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(addRadixPoint) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];//返回应用程序window
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) //遍历window上的所有subview
{
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard view found; add the custom button to it
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
[keyboard addSubview:doneButton];
}
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员 name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
[doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(addRadixPoint) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];//返回应用程序window
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) //遍历window上的所有subview
{
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard view found; add the custom button to it
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
[keyboard addSubview:doneButton];
}
}
0 0
- 在数字键盘上添加button
- 【在数字键盘上添加button】
- 如何在Button上添加图片
- (判断第三方输入法)在系统数字键盘上添加“完成”按钮引发的问题思考
- button上添加文字
- UITableView 上添加button
- 如何在你的IE上添加一个BUTTON
- 关于在navigationItem.titleView上添加button不显示问题
- xib方式 在tableviewcell上添加button (代理方式)
- 在ScrollView上添加button谁先响应?
- Android中在Button文本上添加图片
- 关于在ImageView上添加Button,但是点击没反应
- ios隐藏数字键盘 --在数字键盘左下角添加“完成”按钮的实现原理
- ios在数字键盘左下角添加“完成”按钮的实现原理
- 自定义数字键盘(固定button键盘)
- 数字键盘添加自定义按钮
- 数字键盘添加自定义按钮
- 数字键盘添加自定义按钮
- Red5流媒体直播开发总结
- ios 获取屏幕的属性和宽度
- hibernate和oracle
- OpenNMS全接触-事件及通知(六)
- PHP访问MySQL数据库
- 在数字键盘上添加button
- java实现数字金钱转化为英文字母显示
- google-app-engine 上传下载 用户文件
- 20140226LinkButton中Onclient 事件与<%#Eval("xxxx")%>
- cocos2d-x 如何实现角色在地图中的不同高低台阶行走的路线控制
- Ubuntu 下手动安装 Sublime Text 3
- sql server 2008 R2 安装图解
- Java中ArrayList和LinkedList区别
- PHP 方法重载例子