【问题标题】:Hiding the tabBar in a UITabBarController not changing bottom layout guide to the bottom of the screen在 UITabBarController 中隐藏 tabBar 不会将底部布局指南更改为屏幕底部
【发布时间】:2014-01-14 09:45:07
【问题描述】:

我在我的项目中使用自动布局,并且我的视图控制器中有一个表格视图。因此,我将其与顶部布局指南底部和底部布局指南顶部的垂直间距设置为 0。但是当我隐藏标签栏时,tableView 不会延伸到屏幕底部。这是否意味着iOS在标签栏隐藏时不会调整底部布局指南?

【问题讨论】:

    标签: ios7 autolayout


    【解决方案1】:

    您的问题的答案是否定的,隐藏栏时底部布局指南不会更改。

    为什么?仅仅因为标签栏没有从它的超级视图中删除,它只是被隐藏了,因此底部布局指南不应该改变。如果你再次展示它会发生什么?

    (lldb) po [[[self tabBarController] tabBar] isHidden]
    0x0000000000000001
    
    (lldb) po [[self tabBarController] tabBar]
    <UITabBar: 0x14dd3f890; frame = (0 519; 320 49); hidden = YES; autoresize = W+TM; userInteractionEnabled = NO; layer = <CALayer: 0x17022c760>>
    

    如您所见,栏仍然“存在”,它尚未从层次结构中删除,因此底部布局指南没有改变。这是预期的行为。

    【讨论】:

    • 从其层次结构中删除 tabor 仍然不会更改底部布局指南。我刚刚创建了一个项目,我在其中运行了 self.tabBarController?.tabBar.removeFromSuperview() 并且底部布局指南虽然从层次结构中消失了,但并没有导致底部布局指南发生变化。仍然是 49 像素。
    猜你喜欢
    • 2014-03-18
    • 2020-03-10
    • 2015-06-24
    • 1970-01-01
    • 1970-01-01
    • 2016-10-06
    • 2016-01-29
    • 2020-11-28
    • 2014-07-27
    相关资源
    最近更新 更多