Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.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 导航栏颜色不为';你不能换回去吗?损失7_Ios_Iphone_Objective C_Uinavigationbar - Fatal编程技术网

Ios 导航栏颜色不为';你不能换回去吗?损失7

Ios 导航栏颜色不为';你不能换回去吗?损失7,ios,iphone,objective-c,uinavigationbar,Ios,Iphone,Objective C,Uinavigationbar,我有几个带有导航控制器的TableView。 除最后一个视图为红色外,所有视图的导航栏均为白色。 我有 [[self-navigationController]navigationBar]setTintColor:[UIColor redColor]; 在最后一个tableview的viewDidLoad中 [[self-navigationController]navigationBar]setTintColor:[UIColor-whiteColor]; 在视图中,加载其他表视图 它工作正常

我有几个带有导航控制器的TableView。 除最后一个视图为红色外,所有视图的导航栏均为白色。 我有

[[self-navigationController]navigationBar]setTintColor:[UIColor redColor];

在最后一个tableview的viewDidLoad中

[[self-navigationController]navigationBar]setTintColor:[UIColor-whiteColor];

在视图中,加载其他表视图

它工作正常,直到我到达最后一个视图,导航栏的颜色变为红色。当我返回到以前的视图时,所有以前视图的导航栏都变为红色。我应该将这些代码放在哪里,以便颜色保持不变


谢谢,

将其放入
视图将显示:
。此方法中的代码将在每次视图重新出现时运行。

将其放入
视图将显示:
。此方法中的代码将在每次视图重新出现时运行。

将其放入
视图将显示:
。此方法中的代码将在每次视图重新出现时运行。

t在
视图中显示:
。此方法中的代码将在每次视图重新出现时运行。

仅在调用一次时将
viewdiload
用于初始化目的。在
视图中添加代码将显示
方法应该可以解决问题,因为每次视图出现时都会调用它

但是,我喜欢使用
UIAppearance
通过创建另一个方法来定制类的所有实例的外观-

-(void) setupAppearance {

    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];

    navigationBarAppearance.barTintColor = [UIColor redColor];

    // Another method 
    // [UINavigationBar appearance].barTintColor = [UIColor redColor];
}

仅在调用一次时才将
viewdiload
用于初始化目的。在
viewwillbeen
方法中添加代码应该可以解决问题,因为每次视图出现时都会调用它

但是,我喜欢使用
UIAppearance
通过创建另一个方法来定制类的所有实例的外观-

-(void) setupAppearance {

    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];

    navigationBarAppearance.barTintColor = [UIColor redColor];

    // Another method 
    // [UINavigationBar appearance].barTintColor = [UIColor redColor];
}

仅在调用一次时才将
viewdiload
用于初始化目的。在
viewwillbeen
方法中添加代码应该可以解决问题,因为每次视图出现时都会调用它

但是,我喜欢使用
UIAppearance
通过创建另一个方法来定制类的所有实例的外观-

-(void) setupAppearance {

    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];

    navigationBarAppearance.barTintColor = [UIColor redColor];

    // Another method 
    // [UINavigationBar appearance].barTintColor = [UIColor redColor];
}

仅在调用一次时才将
viewdiload
用于初始化目的。在
viewwillbeen
方法中添加代码应该可以解决问题,因为每次视图出现时都会调用它

但是,我喜欢使用
UIAppearance
通过创建另一个方法来定制类的所有实例的外观-

-(void) setupAppearance {

    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];

    navigationBarAppearance.barTintColor = [UIColor redColor];

    // Another method 
    // [UINavigationBar appearance].barTintColor = [UIColor redColor];
}

谢谢,它工作得很好!它创建了另一个选定单元格保持高亮显示的问题,但通过向ViewWillExample添加Decelrowatindexpath来修复了该问题:)再次感谢!没问题。如果视图控制器是
UIViewController
而不是
UITableViewController
,则必须在
viewWillApp中手动取消选择该行ear
。感谢它工作得很好!它创建了另一个选中单元格保持高亮显示的问题,但通过将Decelrowatindexpath添加到ViewWillDisplay来修复了此问题:)再次感谢!没问题。如果视图控制器是
UIViewController
而不是
UITableViewController
,则必须在
ViewWillDisplay
。感谢它工作得很好!它创建了另一个选定单元格保持高亮显示的问题,但通过向ViewWillDisplay添加DecelRowatindexpath:)再次感谢!没有问题。如果视图控制器是
UIViewController
而不是
UITableViewController
,则必须取消选择行y将出现在
viewwillbeen
中。谢谢,它工作得很好!它造成了另一个选定单元格保持高亮显示的问题,但通过向viewwillbeen添加Decelrowatindexpath:)修复了该问题。再次感谢!没问题。如果视图控制器是
UIViewController
而不是
UITableViewController
,则必须取消选择
视图中手动显示的行将出现