2

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.

Wooble
  • 87,717
  • 12
  • 108
  • 131
codercat
  • 22,873
  • 9
  • 61
  • 85

3 Answers3

4

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

bhavya kothari
  • 7,484
  • 4
  • 27
  • 53
  • i know this approach i tried with this one. i need optimized way. don't need for hardcode any values – codercat Feb 11 '14 at 11:58
0

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);
}];
codercat
  • 22,873
  • 9
  • 61
  • 85
-1

try to set your navigationView's backgroundColor.

Marc
  • 6,051
  • 5
  • 26
  • 56
signal
  • 225
  • 3
  • 11