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

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

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

- (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],您将在旋转过渡期间隐藏d出窗口时忽略动画.

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

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

总结

以上是内存溢出为你收集整理的objective-c – 使用淡出动画关闭旋转时的UIPopover全部内容,希望文章能够帮你解决objective-c – 使用淡出动画关闭旋转时的UIPopover所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1085855.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存