我想要它,这样我的导航栏就不会位于我的表格视图之上,而是与它分开,因此每个 tableView 单元格都以相等的比例显示。实际上,我似乎无法更改它,我尝试以编程方式手动添加它并尝试在视图层次结构中更改它,但我无法做到。我想有一个简单的解决方案我只是无法弄清楚那是什么?下面是我的代码。
override func viewDidLoad() {
super.viewDidLoad()
let navigationBar = UINavigationBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 44))
navigationBar.backgroundColor = UIColor.whiteColor()
navigationBar.delegate = self
let navigationItem = UINavigationItem()
navigationItem.title = "Title"
let leftButton = UIBarButtonItem(title: "Save", style: UIBarButtonItemStyle.Plain, target: self, action: "btn_clicked:")
let rightButton = UIBarButtonItem(title: "Right", style: UIBarButtonItemStyle.Plain, target: self, action: nil)
navigationItem.leftBarButtonItem = leftButton
navigationItem.rightBarButtonItem = rightButton
navigationBar.items = [navigationItem]
self.view.addSubview(navigationBar)
}