这个问题是针对运行 iOS 7 的 Xcode 5 的,非常奇怪。我试图将所有 UInavigation 和 UIBarButtonItem 文本颜色设置为白色。
因此,在我的应用程序启动委托中,我将代码设置为。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImage *NavigationPortraitBackground = [UIImage imageNamed:@"button_header_blue"];
// Set the background image all UINavigationBars
[[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault];
// Set the text appearance for navbar
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor whiteColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Helvetica Neue" size:21], UITextAttributeFont,
nil]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
UITextAttributeTextColor,
[UIColor whiteColor],
UITextAttributeTextShadowColor,
nil];
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState: UIControlStateNormal];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
// Override point for customization after application launch.
return YES;
}
如果我启动“发送邮件”操作两次
- 我第一次看到 UIBarButton 项目是白色的。我看了看然后点击了取消按钮
- 我第二次看到它们时,它们全部变成灰色,除了标题之外几乎看不见。
- 我的 iPhone 模拟器和运行 iOS 7 的 iPhone 都会发生这种情况。
我怎样才能解决这个问题?
我必须这样做才能使其在 iOS 7 上运行
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController.navigationBar setTintColor:[UIColor whiteColor]];
[mailViewController.navigationBar setBarTintColor:[UIColor whiteColor]];
....
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)