UIPopovercontroller 被键盘抬高压缩

来源:互联网 发布:mac必备软件2017 编辑:程序博客网 时间:2024/04/27 11:09

UIPOpovercontroller被抬高压缩的问题,可以通过添加对键盘的监听:

     首先,在viewdidload中监听键盘出现的动作

[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(keyBoardWillShow:)name:UIKeyboardWillShowNotificationobject:nil];

     然后,在有了上面的监听后,键盘弹出时就会调用下面方法,只需在此设置uipopovercontroller的popovercontentsize即可。

-(void)keyBoardWillShow:(id)sender

{

   popView.popoverContentSize =CGSizeMake(320,popView.popoverContentSize.height);

 

}