【发布时间】:2013-03-19 13:34:19
【问题描述】:
我为导航栏设置了 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];
}
一切正常。在我的应用程序中,我需要在堆栈中插入一个视图控制器并弹出它。
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];
此时标题栏失去外观设置,恢复为默认白色。任何推入堆栈的新视图控制器也会失去其外观。
有什么问题?
【问题讨论】:
标签: objective-c uinavigationcontroller uiappearance