zoukankan      html  css  js  c++  java
  • ios 动态监听键盘输入法和高度

        //监听键盘高度变化

        [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(keyboardWasChange:) name:UIKeyboardDidChangeFrameNotificationobject:nil];


        

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

        NSLog(@"Keyboard change");

        NSString *str=[[UITextInputModecurrentInputMode] primaryLanguage];

        NSLog(@"shurufa--------------%@",str);

    //    if ([str isEqualToString:@"zh-Hans"]) {

    //        ReplayView.frame = CGRectMake(0, HEIGHT.height-216-125, 320, 45);

    //    }else

    //    {

    //        ReplayView.frame = CGRectMake(0, HEIGHT.height-216-89, 320, 45);

    //

    //    

    //    }

        

        

        NSDictionary *info = [aNotification userInfo];

        CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;

       // CGRect frame = self.search.frame;

        if (kbSize.height == 216) {

            NSLog(@"english");

            ReplayView.frame = CGRectMake(0, HEIGHT.height-216-89, 320, 45);

        }

        else if(kbSize.height == 252){

            NSLog(@"中文");

            

            ReplayView.frame = CGRectMake(0, HEIGHT.height-216-125, 320, 45);

        }


    }

  • 相关阅读:
    SWPUCTF2019 | 神奇的二维码
    CG-CTF | Hello,RE!
    CG-CTF | I wanna play CTF
    CG-CTF | MD5
    CG-CTF | 综合题2
    CG-CTF | 密码重置2
    CG-CTF | 综合题
    修改input输入框placeholder文字默认颜色
    解决前端浏览器字体小于12px办法
    box-shadow四个边框设置阴影样式
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3106807.html
Copyright © 2011-2022 走看看