Swift:Tableview 在导航栏下方但在状态栏上方滚动? [英] Swift: Tableview scrolls under navigation bar but over status bar?

查看:44
本文介绍了Swift:Tableview 在导航栏下方但在状态栏上方滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下技巧隐藏了导航栏的阴影:

I hid the navigation bar's shadow using the following trick:

    self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
    self.navigationController?.navigationBar.shadowImage = UIImage()

我还有以下套装:

    self.extendedLayoutIncludesOpaqueBars = true
    self.automaticallyAdjustsScrollViewInsets = true
    self.tabBarController?.tabBar.isHidden = true

我的页面上的一切看起来都很好,除了当我向上滚动 tableView 时,它按预期位于导航栏下方,但位于状态栏上方:

Everything looks fine on my page, except that when I scroll up my tableView it goes under the navigation bar as expected, but above the status bar:

如何确保 tableView 在导航栏和状态栏下方滚动?

How do I make sure that the tableView scrolls under both the navigation bar and status bar?

推荐答案

这会将 UITableView 置于状态栏下方.

This will place the UITableView below the status bar.

self.edgesForExtendedLayout=UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars=NO;
self.automaticallyAdjustsScrollViewInsets=NO;

这篇关于Swift:Tableview 在导航栏下方但在状态栏上方滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆