使用Swift 3和Xcode 9我正在使用大UINavigationBar视图:
if #available(iOS 11.0, *) {
navigationBar?.prefersLargeTitles = true
UINavigationBar.appearance().largeTitleTextAttributes = [
NSForegroundColorAttributeName: Colors.black
]
}
Run Code Online (Sandbox Code Playgroud)
当我滚动a时UITableView,条形图会快速折叠,从而产生不需要的空间:
之前:
后:
我碰到UITableView酒吧的那一刻就崩溃了.
tableView具有以下属性:
let rect = CGRect(
x: 0,
y: UIApplication.shared.statusBarView?.frame.height ?? 20,
width: UIScreen.main.bounds.width,
height: UIScreen.main.bounds.height
)
let tableView = UITableView(frame: rect)
Run Code Online (Sandbox Code Playgroud)
最顶层的tableView是self.navigationController?.navigationBar.frame.height ?? 44
另外,tableView设置为:
if #available(iOS 11.0, *) {
self.contentInsetAdjustmentBehavior = .never
}
Run Code Online (Sandbox Code Playgroud)
酒吧是半透明的,我希望保持这一点.我错过了什么?非常感谢帮助.
我使用以下方法让它工作:
if #available(iOS 11.0, *) {
self.contentInsetAdjustmentBehavior = .always
}
Run Code Online (Sandbox Code Playgroud)
和
let tableViewFrame = CGRect(
x: 0,
y: UIApplication.shared.statusBarFrame.height ?? 20,
width: UIScreen.main.bounds.width,
height: UIScreen.main.bounds.height
)
Run Code Online (Sandbox Code Playgroud)
并且没有进一步的 TableView 顶部插图。
| 归档时间: |
|
| 查看次数: |
2870 次 |
| 最近记录: |