【问题标题】:UIPopoverController should prevent scrolling via status barUIPopoverController 应该防止通过状态栏滚动
【发布时间】:2013-10-18 22:59:35
【问题描述】:

我发现在呈现 UIPopoverController 时,并非呈现视图中的所有控件都被禁用。具体来说,导航栏按钮(例如“返回”)保持可选状态。在我看来,这是一个缺陷——它允许弹出框保留在屏幕上,而视图堆栈弹出在它后面。

哦,好吧,至少这可以在演示后立即使用self.aboutPopoverController.passthroughViews = nil 纠正。

除了这不会禁用状态栏,它通常设置为将视图的内容滚动到顶部。

最终结果是能够呈现一个弹出框,然后(在后台)滚动视图,使弹出框上的小箭头/标签不再与原始触摸点对齐。

谁能解释一下这种行为?它是一个功能还是一个错误?有什么解决方法吗?

【问题讨论】:

    标签: ios cocoa-touch uipopovercontroller uipopover uistatusbar


    【解决方案1】:

    一个简单的解决方法可能如下:

    就在您显示UIPopoverController 之前,将UIScrollView 的属性scrollsToTop 设置为NO。这样,当用户点击状态栏时,您的 scrollView 将不会滚动。

    完成弹出框后,您可以重新启用 scrollsToTop 功能。

    这里是UIScrollView documentation

    scrollsToTop
    A Boolean value that controls whether the scroll-to-top gesture is enabled.
    
    @property(nonatomic) BOOL scrollsToTop
    
    Discussion
    The scroll-to-top gesture is a tap on the status bar. When a user makes this gesture, 
    the system asks the scroll view closest to the status bar to scroll to the top. 
    If that scroll view has scrollsToTop set to NO, its delegate returns NO from
    scrollViewShouldScrollToTop:, or the content is already at the top, nothing happens.
    

    希望这会有所帮助!

    【讨论】:

    • 谢谢 - 这实际上接近我目前的解决方法。除了忽略点击之外,我关闭了弹出框并返回 YES
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-30
    • 1970-01-01
    • 2011-11-02
    • 2011-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多