2011-11-03 35 views
4

我在我的項目中使用MPMoviePlayerViewController。所以,現在MPMoviePlayerViewController也使用導航欄MPMoviePlayerViewController與外觀框架(iOS 5)

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] 
        setBackgroundImage:[UIImage imageNamed:@"woodenBarButton"] 
        forState:UIControlStateNormal 
        barMetrics:UIBarMetricsDefault]; 

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationbarBackground"] 
           forBarMetrics:UIBarMetricsDefault]; 

:我已經定義瞭如下外觀UIButtons和UINavigationBar的,像這樣。現在的問題是:按鈕使用給定的外觀,但工具欄不= =>它看起來很糟糕。所以現在我有以下問題:

  1. 我可以說服MPMoviePlayerViewController中的UINavigationBar使用外觀?
  2. 或者can只能爲MPMoviePlayerViewController完全移除外觀。

我試圖通過playerViewController.navigationitem.leftbarbuttonitem訪問按鈕並覆蓋屬性,但這是行不通的。

如果你能幫助我,那會很棒。謝謝。

+0

沒人能幫我嗎? – Saibot

回答

6

您是否還嘗試過爲MPMoviePlayerViewController設置appearanceWhenContainedInappearanceappearanceWhenContainedIn同時工作。

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationbarBackground"] 
          forBarMetrics:UIBarMetricsDefault]; 
[[UINavigationBar appearanceWhenContainedIn:[MPMoviePlayerViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 
+0

工作!完善。 – Saibot

+0

很高興能有所幫助。請將此答案標記爲正確答案(複選標記),因爲它是在stackoverflow上的常見行爲。 thx – Buju

+0

使用此技術還可以在展示MFMessageComposeViewController時去除外觀自定義。謝謝 – jumponadoughnut