【问题标题】:Add subview to view so that it overlays the UITabBar but not the UINavigationBar将子视图添加到视图,使其覆盖 UITabBar 但不覆盖 UINavigationBar
【发布时间】:2014-04-11 10:47:46
【问题描述】:

我想在我当前的 UITableView 中添加一个叠加层 - 以便它覆盖整个表格和屏幕底部的 UITabBar。但是,我不希望它覆盖 UINavigationController。

当我在UITableView 上尝试[self addSubview:] 时,它不会覆盖UITabBar。

在我的故事板中,我有一个UITabBar,每个选项卡都实例化了它自己的UINavigationBar。然后此选项卡包含UITableView

非常感谢任何帮助。

【问题讨论】:

    标签: ios objective-c uitabbarcontroller uinavigationbar


    【解决方案1】:

    将叠加层的 y 原点设置为 44 并将此叠加层添加到导航视图

    [overlayView setFrame:CGRectMake(self.overlayView.frame.origin.x, 44, self.overlayView.frame.size.width, self.overlayView.frame.size.height)];
    [self.navigationController.view addSubview:overlayView];
    

    在 iOS7 上运行时不要忘记在 y 原点上添加 +20。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-12
      相关资源
      最近更新 更多