3

UIActivityViewController を提示する奇妙な問題が発生しています。

アプリケーションのルート ビューから UIActivityViewController を表示すると、ボタンのタイトルが正しい色になります。

ここで、詳細ビュー コントローラーからルート ビュー コントローラーに戻り、上記の UIActivityViewController を提示すると、提示されたコントローラーは何らかの理由で提示コントローラーのボタン タイトルの色を継承しています。バーのスタイルをデフォルトに強制しようとしましたが、それも機能しません。UIActivityViewController のボタンの外観を設定しても、MFMailComposeViewController のようには機能しません。

提供されるヘルプは大歓迎です!スクリーンショット:

ここに画像の説明を入力 ここに画像の説明を入力

detailviewcontroller のボタンの色を設定するために使用しているコード:

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.navigationController.navigationBar.topItem.title = @"Back";

    UIButton *Button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    [Button2 addTarget:self action:@selector(heh) forControlEvents:UIControlEventTouchUpInside];
    [Button2 setImage:[UIImage imageNamed:@"button.png"] forState:UIControlStateNormal];
    [Button2 setImage:[UIImage imageNamed:@"buttonPressed.png"] forState:UIControlStateHighlighted];
    Button2.frame = CGRectMake(0.0, 0.0, 44, 44);

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:Button2];
}
4

1 に答える 1

1

UIActivityViewControllerを閉じた後、詳細ビューコントローラーのバーボタン項目のタイトルの色を手動で変更する必要がありました。

[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], [UIViewController class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor], UITextAttributeTextColor, [UIColor clearColor], UITextAttributeTextShadowColor, CGSizeMake(0, 0), UITextAttributeTextShadowOffset, [UIFont fontWithName:@"HelveticaNeue-Light" size:16], UITextAttributeFont, nil]
                                                                                        forState:UIControlStateNormal];
于 2013-06-27T21:09:03.480 に答える