zoukankan      html  css  js  c++  java
  • ios5键盘问题

     最近做的ios输入键盘在ios5上面有问题,主要是ios5上面中文键盘,会对出来一块,我原来用的是toolbar和输入键盘不是在一起的,而位置是写死的,这样就造成了ios5上面会遮盖,在网上找了下,解决方法如下,实际上就是获得输入键盘的高度,而不要写死位置,这样也避免以后出问题。

    - (void)viewDidLoad

    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(keyboardWillShown:)
    name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(keyboardWillHidden:)
    name:UIKeyboardWillHideNotification object:nil];
    }

    - (void)keyboardWillHidden:(NSNotification*)aNotification
    {

    }

    - (void)keyboardWillShown:(NSNotification*)aNotification
    {
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;//得到键盘的高度
    }

    - (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
    [super dealloc];
    }

  • 相关阅读:
    Java Web三层架构设计深思
    编译C源码软件需要的工具
    Hibernate之表间关系
    CSS之颜色字体
    主流的微服务框架
    CSS布局思考
    Android创建新项目及开发
    Google工程师解析Android系统架构
    java多线程实用操作
    Spring IOC/DI/注解
  • 原文地址:https://www.cnblogs.com/hellocby/p/2747675.html
Copyright © 2011-2022 走看看