首页 > 其他 > 详细

UIKeyboardWillShowNotification

时间:2015-05-12 13:05:21      阅读:78      评论:0      收藏:0      [点我收藏+]

UIKeyboardWillShowNotification 通知来获得当键盘改变时,该键盘的高度和位置。 
然后调整自己相应的UI元素位置即可,示例代码如下: 
 
 

-(void)viewDidLoad{ 
   [superviewDidLoad]; 
   [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 

-(void)viewDidUnload{ 
   [superviewDidUnload]; 
   [[NSNotificationCenter defaultCenter]removeObserver:self]; 

-(void)keyboardWillShow:(NSNotification*)notification{ 
   NSDictionary*info=[notification userInfo]; 
   CGSize kbSize=[[info objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].size; 
   NSLog(@"keyboard changed, keyboard width = %f, height = %f",  
          kbSize.width,kbSize.height); 
   //在这里调整UI位置 

 
 

UIKeyboardWillShowNotification

原文:http://www.cnblogs.com/woaixixi/p/4496897.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!