下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
//需要手动调用 registerForKeyboardNotifications 方法,其他两个会自动调用,d出的键盘高 216(输入英文时候),ios 5 系统的@implementation VIEwController- (voID)vIEwDIDLoad{ [super vIEwDIDLoad]; [self registerForKeyboardNotifications]; UITextVIEw *tv = [[UITextVIEw alloc] initWithFrame:CGRectMake(100,100,50)]; [self.vIEw addSubvIEw:tv]; [tv release];}- (voID) registerForKeyboardNotifications{ [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(keyboarDWasShown:) name:UIKeyboardDIDShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(keyboarDWasHIDden:) name:UIKeyboardDIDHIDeNotification object:nil];}- (voID) keyboarDWasShown:(NSNotification *) notif{ NSDictionary *info = [notif userInfo]; NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey]; CGSize keyboardSize = [value CGRectValue].size; NSLog(@"keyBoard:%f",keyboardSize.height); //216 ///keyboarDWasShown = YES;}- (voID) keyboarDWasHIDden:(NSNotification *) notif{ NSDictionary *info = [notif userInfo]; NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey]; CGSize keyboardSize = [value CGRectValue].size; NSLog(@"keyboarDWasHIDden keyBoard:%f",keyboardSize.height); // keyboarDWasShown = NO; }- (voID)dIDReceiveMemoryWarning{ [super dIDReceiveMemoryWarning]; // dispose of any resources that can be recreated.}@end
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的动态获取键盘高度全部内容,希望文章能够帮你解决动态获取键盘高度所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)