Pra*_*raf 6 objective-c popover ipad uipopovercontroller ios
背景:
我需要显示一个带有搜索字段的imageview(rect而不是barbutton)的popover.需要从UIModalPresentationFormSheet中显示popover.这已成功实现
问题:
我面临的问题(在横向模式下)是当键盘显示时模态表单向上移动并且弹出窗口我的框架.然后弹出框保持在原始位置(键盘显示之前)和呈现rect向上移动.我应用的解决方案是从更改后的矩形表示(using presentPopoverFromRect)弹出窗口-(void)didShowKeyBoard:(NSNotification*) notif并执行相同的操作-(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];
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
有人可以指导我这样做的正确方法吗?
任何帮助都非常感谢.
嗯,这部分解决了我的问题。我使用调度来延迟弹出窗口演示。如下所示:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_USEC), dispatch_get_current_queue(), ^{
[_statePopover presentPopoverFromRect:statehandler.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
});
Run Code Online (Sandbox Code Playgroud)
当我的键盘被关闭时,这可以按要求工作,但当显示键盘时,相同的代码片段无法提供所需的结果。
如果有人知道为什么会出现这样的情况,请发表评论。谢谢!
| 归档时间: |
|
| 查看次数: |
637 次 |
| 最近记录: |