UINavigationBar goes black

First of all, when I call presentViewController: navigationController appears with the usual green navigation bar. But after the animation is complete, the navigation bar gets a little darker.

if(!userPageViewController)
    userPageViewController = [[UserPageViewController alloc]initWithUser:tempUser];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:userPageViewController];
[self presentViewController:navigationController animated:YES completion:nil];

When I press the home button, the navigation bar turns black, as in this image. https://dl.dropboxusercontent.com/u/14066789/2013-12-04%2012.27.45.png

The top line in the xib file is set to a transparent navigation bar. Why does it turn black?

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @" ";
    [myTableView setBackgroundColor:[UIColor clearColor]];

    UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleBordered target:self action:@selector(backPressed:)];
    self.navigationItem.leftBarButtonItem = btn;
    self.navigationItem.backBarButtonItem  = nil;

    UIBarButtonItem *exitBtn = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleBordered target:self action:@selector(logOut:)];
    self.navigationItem.rightBarButtonItem = exitBtn;
    scroll.contentSize = CGSizeMake(320.0f, 400.0f);

    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
        self.edgesForExtendedLayout = UIRectEdgeNone;

}

-(void)viewWillAppear:(BOOL)animated
{
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
    {
        UIColor * barColor = [UIColor
                              colorWithRed:222.0/255.0
                              green:255.0/255.0
                              blue:229.0/255.0
                              alpha:1.0];
        [self.navigationController.navigationBar setBarTintColor:barColor];
        UIColor * barTintColor = [UIColor
                                  colorWithRed:48.0/255.0
                                  green:140.0/255.0
                                  blue:76.0/255.0
                                  alpha:1.0];
        [self.navigationController.navigationBar setTintColor:barTintColor];

        NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                                   barTintColor,UITextAttributeTextColor,
                                                   [UIColor clearColor], UITextAttributeTextShadowColor,
                                                   [NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset, nil];

        [[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];


    }
    else
    {
        UIColor * barColor = [UIColor
                              colorWithRed:73.0/255.0
                              green:208.0/255.0
                              blue:114.0/255.0
                              alpha:1.0];
        [self.navigationController.navigationBar setTintColor:barColor];

    }

}
+4
source share
1 answer

. "Transcluent" . "Document Outline" , .

+4

All Articles