微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

objective-c – 使用淡出动画关闭旋转时的UIPopover

Apple页面和数字应用程序具有弹出窗口(用于“工具”等),当您旋转设备时,它们会以可爱的淡出效果关闭.我正在尝试重新创建这个,但我的弹出窗口似乎总是立即关闭,因此旋转的动画看起来并不那么平滑.我目前正在使用:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{    
    [toolsPopoverController dismisspopoverAnimated:YES];
}

有没有人知道在Pages / Numbers中实现相同效果的最佳方法

谢谢!

解决方法

基于UIPopoverController的文档(重点添加):

If the user rotates the device while a popover is visible,the popover controller hides the popover and then shows it again at the end of the rotation. The popover controller attempts to position the popover appropriately for you but you may have to present it again or hide it altogether in some cases. For example,when displayed from a bar button item,the popover controller automatically adjusts the position (and potentially the size) of the popover to account for changes to the position of the bar button item. However,if you remove the bar button item during the rotation,or if you presented the popover from a target rectangle in a view,the popover controller does not attempt to reposition the popover. In those cases,you must manually hide the popover or present it again from an appropriate new position. You can do this in the didRotateFromInterfaceOrientation: method of the view controller that you used to present the popover.

看起来通过在willAnimateRotationToInterfaceOrientation:方法调用[toolsPopoverController dismisspopoverAnimated:YES],您将在旋转过渡期间隐藏弹出窗口时忽略动画.

如果在didRotateFromInterfaceOrientation:方法调用dismisspopoverAnimated:YES方法,则在调用dismiss动画之前,应在新位置使用popover的认行为.

如果此时认动画仍然不是您想要的,我会创建一个自定义动画块并明确管理淡出或重新调整大小以满足您的需求.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐