iOS虚拟键盘上添加动态按钮
之前在 在iOS虚拟键盘上添加动态隐藏按钮一文中描叙了关于键盘上添加动态按钮的操作,发现键盘上的按钮显示出来的时候很僵硬,此处做了改进,添加了动画过渡,更换了图片,能够让人感觉按钮是随着键盘的动画显示而显示,随着键盘的动画退出而退出,看上去更加流畅些;
效果图:
- (void)viewDidLoad
{
NSLog(@"%@",NSStringFromSelector(_cmd));
[super viewDidLoad];
exitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[exitButton setImage:[UIImage imageNamed:@"down.png"] forState:UIControlStateNormal];
CGRect exitBtFrame = CGRectMake(self.view.frame.size.width-48, self.view.frame.size.height , 48.0f, 30.0f);
[exitButton setFrame:exitBtFrame];
[self.view addSubview:exitButton];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardDidShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)handleKeyboardDidShow:(NSNotification *)notification
{
NSLog(@"%@",NSStringFromSelector(_cmd));
NSDictionary *info = [notification userInfo];
NSLog(@"-->info:%@",info);
CGRect keyboardFrame;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
今日头条
更多>>您可能感兴趣的文章
- Android:实现TabWidget选项卡按钮在屏幕下方
- iPhone开发学习笔记006—— NSNotification自定义通知名
- ios开发问题:添加库和复制其它工程文件编译错误问题
- ios学习笔记(二)xcode 4.3.2下实现基本交互
- 多线程之NSInvocationOperation
- iphone开发之object c基础一定义接口
- (iPhone/iPad开发)presentViewController相应方法在SDK5.0前后
- Memory on the iPhone
- Lexical or Preprocessor Issue 'xxx.h
- iPhone应用开发之十一:常用的三种动画表现效果