【问题标题】:MPMoviePlayerViewController vs. Appearance-Framework (iOS 5)MPMoviePlayerViewController 与外观框架 (iOS 5)
【发布时间】:2011-11-03 22:05:56
【问题描述】:

我在我的项目中使用 MPMoviePlayerViewController。我为 UIButtons 和 UINavigationbar 定义了以下外观,如下所示:

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

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

所以现在 MPMoviePlayerViewController 也在使用导航栏。现在的问题是:按钮使用给定的外观,但工具栏没有 => 它看起来很糟糕。所以现在我有以下问题:

  1. 我可以说服 MPMoviePlayerViewController 中的 UINavigationBar 使用外观吗?
  2. 或者可以完全删除 MPMoviePlayerViewController 的外观。

我尝试通过 playerViewController.navigationitem.leftbarbuttonitem 访问按钮并覆盖属性,但这不起作用。

如果你能帮助我,那就太好了。谢谢。

【问题讨论】:

  • 这里没有人可以帮助我吗?

标签: ios5 uinavigationbar uibarbuttonitem appearance


【解决方案1】:

您是否尝试过将appearanceWhenContainedIn 设置为MPMoviePlayerViewControllerappearanceappearanceWhenContainedIn 同时工作。

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

【讨论】:

  • 很高兴能帮上忙。请将此答案标记为正确答案(复选标记),因为它是 stackoverflow 上的常见行为。谢谢
  • 在呈现 MFMessageComposeViewController 时也使用了这种技术来移除外观定制。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-17
  • 2011-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多