iOS开发中监听键盘状态、输入法状态
来源:互联网 发布:mac动态壁纸 编辑:程序博客网 时间:2024/05/16 08:56
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //监听键盘状态 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; //监听输入法状态 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeInputMode:) name:UITextInputCurrentInputModeDidChangeNotification object:nil]; } #pragma mark Notification //keyBoard已经展示出来 - (void)keyboardDidShow:(NSNotification *)notification { NSValue* aValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey]; CGRect keyboardRect = [aValue CGRectValue]; CGRect keyboardFrame = [self.view convertRect:keyboardRect fromView:[[UIApplication sharedApplication] keyWindow]]; CGFloat keyboardHeight = keyboardFrame.size.height; NSLog(@"##keboardHeight=%.2f",keyboardHeight); } //输入法发生切换 -(void)changeInputMode:(NSNotification *)notification{ NSString *inputMethod = [[UITextInputMode currentInputMode] primaryLanguage]; NSLog(@"inputMethod=%@",inputMethod); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }@end
来源 : http://www.lvtao.net/ios/522.html
0 0
- iOS开发中监听键盘状态、输入法状态
- iPhone开发【二十八】监听键盘状态、输入法状态
- android开发键盘状态监听
- 监听键盘状态
- swift 监听键盘状态
- iOS笔记监听键盘状态 获取键盘高度
- iOS开发之-------监听textfield编辑状态
- iOS开发之-------监听textview编辑状态
- cocos TextField + ios键盘 状态监听 移动view
- Android监听键盘状态变化
- Android-监听虚拟键盘状态
- ios网络状态监听
- iOS 监听耳机状态
- ios-监听网络状态
- ios 网络状态监听
- iOS 监听网络状态
- iOS开发中实时监听app的网络连接状态问题
- ios 开发在应用中监听(判断)来电状态-接听-拒接-CoreTelephony
- 重庆静脉曲张治疗
- 重庆静脉曲张治疗的方法
- 二维码开发,扫描,生成
- mongodb3.0 单机数据迁移 分片复制集
- iOS AutoLayout保证view在StatusBar下
- iOS开发中监听键盘状态、输入法状态
- 带描边的TextView
- 1-- 选择排序之简单选择排序
- java解析逻辑表达式
- Android的代码混淆————ProGuard
- shell循环和条件判断
- Go语言的fmt包中文教程 %s
- 批处理添加环境变量
- JavaWeb学习总结(五十)——文件上传和下载