ナビゲーション バー用に UIAppearance をセットアップしました。
[[UINavigationBar appearance] setTitleTextAttributes: [self navigationBarTitleTextAttributes]];
-(NSDictionary *)navigationBarTitleTextAttributes
{
// UINavigationBar title
NSNumber *navBarTitleShadowOpacity = [self.personalityDictionary objectForKey:kNavBarTitleShadowOpacity];
UIColor *navBarTitleColor = [UIColor colorWithHexString: [self.personalityDictionary objectForKey:kNavBarTitleColor] alpha:1.0f];
UIColor *navBarTitleShadowColor = [UIColor colorWithHexString:[self.personalityDictionary objectForKey:kNavBarTitleShadowColor] alpha: [navBarTitleShadowOpacity floatValue]];
return [NSDictionary dictionaryWithObjectsAndKeys:
navBarTitleColor, UITextAttributeTextColor,
navBarTitleShadowColor, UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil];
}
すべてが完璧に機能します。アプリのある時点で、View Controller をスタックに挿入してポップする必要があります。
ChatsViewController* chatsViewController = [[ChatsViewController alloc] init];
NSMutableArray *mutableViewControllers = [self.navigationController.viewControllers mutableCopy];
[mutableViewControllers insertObject: chatsViewController atIndex: [mutableViewControllers count] - 1];
[self.navigationController setViewControllers: mutableViewControllers animated: NO];
[self.navigationController popToViewController: chatsViewController animated: YES];
この時点で、タイトル バーの外観設定が失われ、既定の白に戻ります。スタックにプッシュされた新しいView Controllerも外観を失います。
どうしたの?