开发者

Using undecorated UiNavigationBar

开发者 https://www.devze.com 2022-12-23 09:14 出处:网络
I would like to use UINavigationBar without decoration. I.e. I would like to create my own custom buttons and link those to the same actions (e.g. back) as the navigation items were linked to and have

I would like to use UINavigationBar without decoration. I.e. I would like to create my own custom buttons and link those to the same actions (e.g. back) as the navigation items were linked to and have no bar presented at the top. I was told that one should use navigation bar even though graphically you should design the interaction yourself.

How do I go about doing this? I am quite new to navigation bar to start with...

If there 开发者_运维技巧is some tutorial you can direct me to it would be great (that is for using nav-bar without decoration).

Thanks in advance!

Regards, Niklas


You can hide the navigation bar from a subview controller with

[self.navigationController setNavigationBarHidden:YES animated:NO];

Then just add your own buttons wherever you want on your subview controllers. To go back, just use

[self.navigationController popViewControllerAnimated:YES];

However, this approach does require that you have the buttons on each subview controller rather than just once in the navigation controller. You could instead add a subview in the navigation controller's view that obscures the navigation controller instead. There are other options as well, but they are probably not as useful.


You can use an UINavigationController to manage the stack of views, but hide the navigation bar and build your custom UI to replace it. Then call the corresponding push/pop methods to bring up the different views.

0

精彩评论

暂无评论...
验证码 换一张
取 消