背景:
我需要从一个带有搜索框的imageview(而非barbutton)中显示一个popover,该popover需要从UIModalPresentationFormSheet中呈现。这已经成功实现了。
问题:
我所面临的问题(在横向模式下)是当键盘弹出时,模态表单表单会向上移动,并带着我的popover框架。因此,popover仍然停留在其原始位置(在显示键盘之前),并且呈现的框架被向上移动了。
我应用的解决方案是在-(void)didShowKeyBoard:(NSNotification*) notif
中通过改变的rect来表示(使用presentPopoverFromRect)
popover,在-(void)didhideKeyBoard:(NSNotification*) notif
中做同样的事情。这个方法可以很好的工作,但过渡非常快速和反弹。
那么,如何才能实现这样一个平稳的过渡呢?
我尝试过的方法
我尝试过:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:5.0f];
[_statePopover presentPopoverFromRect:stateHandler.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO];
[UIView commitAnimations];
但是它没有起作用。
请有人指导我正确的做法吗?
非常感谢任何帮助。