【发布时间】:2018-08-27 15:45:24
【问题描述】:
我正在尝试在带有透明导航栏的 UIViewController 中布局表格视图。我已经在我的自定义 UINavigationController 上使用了这段代码:
navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationBar.shadowImage = UIImage()
navigationBar.isTranslucent = true
在我的情节提要上,我将 tableView 的边缘固定到安全区域,但顶部除外,它固定在超级视图的顶部。
问题是我的 tableView 不是从屏幕顶部开始,但好像导航栏仍然不透明。我检查了 tableView 插图,所有内容都为零。我在这里做错了什么?
谢谢
【问题讨论】:
-
确保
edgesForExtendedLayout至少包含.top。即设置viewDidLoadedgesForExtendedLayout = [.top]并检查
标签: ios swift uitableview autolayout