0

MFMailComposeViewController を使用しています。ios7 でナビゲーションバーの背景画像を MFMailComposeViewController に追加できません。以前は ios7 で動作していたコードですが、ios7 では動作しません。ios7 でナビゲーションバーの背景画像を MFMailComposeViewController に追加するにはどうすればよいですか?

    MFMailComposeViewController *mailCompose = [[MFMailComposeViewController alloc] init];
    mailCompose.mailComposeDelegate = self;
    [mailCompose setSubject:@"SubjectName"];
    [mailCompose setMessageBody:shareBodyString isHTML:NO];
    if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
    {
      [self presentViewController:mailCompose animated:YES completion:nil];
    } 
    else {
         [self presentModalViewController:mailCompose animated:YES];
    }

    [mailCompose.topViewController.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationbar-background.png"] forBarMetrics:UIBarMetricsDefault];  // working before ios7 
4

2 に答える 2

0

既にナビゲーション バーをカスタマイズしていて、MFMailComposeViewController を適用する場合は、UIAppearance プロキシでのみ実行できます。iOS 7.1.1 の場合、ナビゲーション バーの背景を置き換えましたが、ステータス バーの背景を変更できませんでした。また、後続の呼び出しでバー ボタンの項目がグレー表示されました。したがって、MFMailComposeViewController を作成する前に、カスタマイズを停止し、既定のナビゲーション バー スタイルに戻そうとしました。

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
[[UINavigationBar appearance] setTintColor:nil];
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName,[UIFont fontWithName:@"Helvetica-Bold" size:18.0], NSFontAttributeName, nil]];

 MFMailComposeViewController *mailComposer =[[MFMailComposeViewController alloc] init];
于 2015-03-16T13:01:20.663 に答える