Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UINavigationBar变黑_Ios_Iphone_Uinavigationcontroller_Uinavigationbar - Fatal编程技术网

Ios UINavigationBar变黑

Ios UINavigationBar变黑,ios,iphone,uinavigationcontroller,uinavigationbar,Ios,Iphone,Uinavigationcontroller,Uinavigationbar,首先,当我调用presentViewController:navigationController时,它会以正常的绿色导航栏显示。但动画完成后,导航栏会变得有点暗 if(!userPageViewController) userPageViewController = [[UserPageViewController alloc]initWithUser:tempUser]; UINavigationController *navigationController = [[UINavig

首先,当我调用presentViewController:navigationController时,它会以正常的绿色导航栏显示。但动画完成后,导航栏会变得有点暗

if(!userPageViewController)
    userPageViewController = [[UserPageViewController alloc]initWithUser:tempUser];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:userPageViewController];
[self presentViewController:navigationController animated:YES completion:nil];
当我按下home(主页)按钮时,导航栏会变成黑色,如图所示。

xib文件中的顶部栏设置为半透明导航栏 为什么会变成黑色

- (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];

    }

}
我也有同样的问题。 通过关闭序列图像板中我的根导航控制器的导航栏属性中的“转换”复选框修复。
您需要打开名为“文档大纲”的左窗格,左下角有一个小按钮,以找到导航栏。

在您的情况下:
如果([[[[UIDevice currentDevice]systemVersion]floatValue]>=7)
7
不是浮点值,请将其更改为
7.0
,尽管我将半透明更改为不透明,但其仍将变为黑色。更改为float也没有帮助。您是否找到了此问题的解决方案?或者,如果您在代码中创建了
UINavigationController
,请将其
navigationBar.transparent
设置为
NO
。尝试此链接: