• 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);

        }


    }

  • 相关阅读:
    带你走进Ajax
    基础
    基础
    基础-文字
    C++ part6.5
    操作系统 part4
    操作系统 part3
    计算机网络 part3 HTTP&HTTPS
    计算机网络 part2
    计算机网络 part1 TCP
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3106807.html
Copyright © 2020-2023  润新知