2013-06-27 29 views
3

我有一個奇怪的問題,呈現UIActivityViewController。UIActivityViewController有錯誤的按鈕標題顏色

當我從我的應用程序的根視圖呈現UIActivityViewController時,按鈕標題是正確的顏色。

現在,但如果我從導航回到根視圖控制器的細節視圖控制器和呈現上面列出的UIActivityViewController,所提出的控制器被繼承呈現控制器的按鈕標題顏色出於某種原因。我嘗試強制將欄樣式設置爲默認,但這也不起作用。設置UIActivityViewController的按鈕外觀不像使用MFMailComposeViewController一樣工作。

提供的任何幫助非常感謝!截圖:我使用的設置我的detailviewcontroller的按鈕顏色

enter image description here enter image description here

代碼:

- (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]; 
} 
+0

我看不到你的代碼在哪裏設置顏色。無論如何,你有外觀定製這個問題有類似的問題嗎? http://stackoverflow.com/questions/13405390/customized-back-button-appears-on-uiimagepickercontroller – SolidSun

+0

我試過了你給我的建議鏈接,它不起作用。 – klcjr89

+0

編輯:它適用於MFMailComposeViewController和MFMessageComposeViewController,但不是UIActivityViewController – klcjr89

回答

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];