Changing navigation title programmatically

后端 未结 14 2207
长情又很酷
长情又很酷 2020-11-28 19:34

I have a navigation bar with a title. When I double click the text to rename it, it actually says it\'s a navigation item, so it might be that.

I\'m trying to change

14条回答
  •  借酒劲吻你
    2020-11-28 19:59

    and also if you will try to create Navigation Bar manually this code will help you

    func setNavBarToTheView() {
        let navBar: UINavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 64.0))
        self.view.addSubview(navBar);
        let navItem = UINavigationItem(title: "Camera");
        let doneItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.cancel, target: self, action: #selector(CameraViewController.onClickBack));
        navItem.leftBarButtonItem = doneItem;
        navBar.setItems([navItem], animated: true);
    }
    

提交回复
热议问题