导航栏自行更改栏

Navigation Bar changes bar on it's own

我有一个包含 UITAbleView 的 UIViewController。

我使用块从视图控制器推送新视图:

_noviyVC.presentPlease = ^(UIViewController *controller)
{
    [weakself.navigationController pushViewController:controller animated:YES];
};

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    ProfileVCC *profile = [[ProfileVCC alloc] init];
    profile.userId = _users[indexPath.row][@"id"];

    if (self.presentPlease)
    {
        self.presentPlease(profile);
    }
}

但最后我得到了这个:

导航栏颜色变为黑色。我做错了什么?

我不明白为什么颜色会自动改变,但你可以使用下面的代码来设置颜色,同时检查你是否没有为 UITableView 的背景设置任何颜色。

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
        // iOS 6.1 or earlier
        [self.navigationController.navigationBar setTintColor:[UIColor yellowColor]];
    } else {
        // iOS 7.0 or later     
        [self.navigationController.navigationBar setBarTintColor:[UIColor yellowColor]];
        self.navigationController.navigationBar.translucent = NO;
    };
self.navigationController.navigationBar.barTintColor=ColorNav;
self.navigationController.navigationBar.translucent=FALSE;

试试这个,

_noviyVC.presentPlease = ^(UIViewController *controller)
{
    [self.navigationController pushViewController:controller animated:YES];
};