0
我正在對導航欄進行一些更改,並顯示在appdelegate中。UIAppearance子視圖從導航欄中消失
這是我的方法:
-(void) setAppearance{
NSMutableDictionary *titleBarAttributes = [NSMutableDictionary dictionaryWithDictionary: [[UINavigationBar appearance] titleTextAttributes]];
[titleBarAttributes setValue:[UIFont fontWithName:@"AvantGarde-ExtraLight" size:18] forKey:NSFontAttributeName];
[titleBarAttributes setValue:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
[[UINavigationBar appearance] setTitleTextAttributes:titleBarAttributes];
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:6.0/256.0 green:57.0/256.0 blue:84.0/256.0 alpha:1.0]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
int borderSize = 3;
UIImageView *navBorder = [[UIImageView alloc] initWithFrame:CGRectMake(0,
41,
320,
borderSize)];
navBorder.image = [UIImage imageNamed:@"energy_line"];
navBorder.tag = 999;
[[UINavigationBar appearance] addSubview:navBorder];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
我有我的appdelegate的方法是設置窗口給我的第一的viewController,當我把這種方法,我navBorder從導航欄刪除。我不明白爲什麼會發生這種情況,沒有任何代碼可以改變viewcontroller中導航欄中的任何內容。
- (void)rootView
{
[self.window setRootViewController:initialViewController];
}