Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a UIView that can cover the navigation bar?

I want to show the UIView in full screen, but show the status bar, other things, like the navigation bar need to cover by the UIView.

How can I do that ?

like image 365
DNB5brims Avatar asked Aug 18 '10 10:08

DNB5brims


People also ask

How do I hide the navigation bar in Swift?

First, we'll hide the shadow image, by setting it to empty image and see how it looks. Now, we'll also hide the background image just like shadow image, and it will look like the navigation bar has disappeared.

How do I stop my view going under the navigation bar?

navigationBar. translucent = NO; This will fix the view from being framed underneath the navigation bar and status bar. in your viewDidLoad method.

How do I customize the navigation bar in Swift?

Go to the ViewController. swift file and add the ViewDidAppear method. a nav helper variable which saves typing. the Navigation Bar Style is set to black and the tint color is set to yellow, this will change the bar button items to yellow.


3 Answers

I believe what he was asking was how to make a UIView cover the entire screen (sort of like custom pop up). This is precisely how I ended up here. So I will offer my solution. Call this function anywhere.

[self.navigationController.view addSubview:yourUIView];

Here the view you introduced cover over the whole screen unlike

[self.view addSubview:yourUIView]; 

Whereby, the navigation bar is uncovered.

like image 170
Byte Avatar answered Oct 14 '22 21:10

Byte


Add the view to your main UIWindow instance directly as a subview.

like image 38
Eiko Avatar answered Oct 14 '22 21:10

Eiko


Struggling a little to fully understand the question, but I think you're asking how you can display a UIView above another view (so that the view with the navigation controls is completely hidden by the second view)?

UIViewController has:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated

It would be wise to have your second view managed by a UIViewController, too. For the sake of example let's say your view with the navigation bar is managed by UINavigationViewController, and the view you want to display is managed by otherViewController...

[navigationViewController presentModalViewController:otherViewController animated:YES];
like image 1
dannywartnaby Avatar answered Oct 14 '22 21:10

dannywartnaby