codercat
codercat

Reputation: 23271

Why black screen display between navigationBar and view

In my project have Two View Controller(First & Second) embed in a navigation controller and Translucent is set NO. but i have used prompt in First ViewController.

I used AutoLayout. if you know the solution with and without AutoLayout i will really happy

enter image description here

enter image description here

when i push to second viewcontroller. i got some black screen under navigation bar

enter image description here

I tried plenty of concept but any helped.

help me How to fix.

NOTE:

Don't say set Translucent is YES. I know if i set yes it works perfectly. but i need achieve with Translucent is NO

Updated 1: Images are updated.

Upvotes: 2

Views: 857

Answers (3)

codercat
codercat

Reputation: 23271

i used this code. but i won't any hardcode solution. if you have know any other solution please share

[UIView animateWithDuration:0.3 animations:^{
        self.view.frame=CGRectMake(0, self.navigationController.navigationBar.frame.size.height+20, 320, 504);
}];

Upvotes: 0

bhavya kothari
bhavya kothari

Reputation: 7474

I have turned off Autolayout - and found following solution

ViewController First

-(void)viewWillDisappear:(BOOL)animated
{
     self.view.backgroundColor = [UIColor whiteColor];

}

ViewController Second

 -(void)viewWillLayoutSubviews
 {
    AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
    appDelegate.window.backgroundColor = [UIColor whiteColor];
    self.myView.frame = CGRectMake(0.0, 64.0, 320.0, 504.0);

 }

I hope this helps, for Autolayout it works fine as well

Upvotes: 4

signal
signal

Reputation: 225

try to set your navigationView's backgroundColor.

Upvotes: -1

Related Questions