Custom navigation bar

2020-05-11 10:44发布

I was crawling Dribble and found the attached design. I was wondering how to do a custom navigation bar like this. I mean how create the navigation bar once and reuse it implicitly for every view controllers.

I was thinking about having a kind of root view controller and inherit for other view controllers, but I don't know how to do this.

Any idea or link will be appreachated!

Cheers.

Cyril

Nav bar image

7条回答
时光不老,我们不散
2楼-- · 2020-05-11 11:45

You can use the stock UINavigationController and hide the UINavigationBar.

Then, make your own subclass of UIViewController which has all of the navigation elements, and then a flexing size view where the contents go. Make all of your classes subclass this element and draw into the view. The button simply has to call [self.navigationController popViewControllerAnimated:YES] and the UILabel at view just has to set its text to self.title.

查看更多
登录 后发表回答