Post

Replies

Boosts

Views

Activity

Reply to Regarding the issue of navigation bar hierarchy in iOS 18
In order to describe the problem more clearly, I have uploaded some files and demo, hoping to understand my difficulties。 My first controller: override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = UIColor.red // Do any additional setup after loading the view. let companyLogo = UIImageView(image:#imageLiteral(resourceName: "logo")) navigationItem.titleView = companyLogo let customView = UIView(frame: CGRect(x: 200, y: 5, width: 40, height: 20)) customView.backgroundColor = UIColor.blue navigationController?.navigationBar.addSubview(customView) let button = UIButton(type: .custom) button.backgroundColor = UIColor.green button.frame = CGRect(x: 100, y: 300, width: 100, height: 100) self.view.addSubview(button) button.addTarget(self, action: #selector(clickAction), for: .touchUpInside) } Button click event: @objc private func clickAction() { let second = SecondViewController() navigationController?.pushViewController(second, animated: true) } When I execute a back in SecondViewController, during this animation process, customeview is briefly overwritten by navigationItem.titleView. I want to know why this is happening?
1w