我在更改MPMediaPickerController的导航栏时遇到了一些麻烦。据我所知,Apple文档说:
这个类确实支持子类化。此类的视图层次结构是私有的;不要修改视图层次结构。
这是否意味着在iOS 7中我们遇到了黑色透明条形样式?它不支持不同的导航栏样式或不同的背景图像吗?
我尝试对拣货导航控制器进行一些简单的更改但无济于事:
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
UIImage* bgImage = [[UIImage imageNamed: @"header" ] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
[picker.navigationController.navigationBar setBackgroundImage: bgImage forBarMetrics: UIBarMetricsDefault];
[picker.navigationController.navigationBar setBarStyle: UIBarStyleBlackOpaque];
[self presentViewController: picker animated: YES completion: nil];
此外,对应用程序导航栏外观代理所做的更改似乎也没有提升到媒体选择器..
有什么想法吗?
谢谢!
答案 0 :(得分:0)
试试这个:
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
UIImage* bgImage = [[UIImage imageNamed: @"header" ] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
[picker.navigationController.navigationBar setBackgroundImage: bgImage forBarMetrics: UIBarMetricsDefault];
[picker.navigationController.navigationBar setBarStyle: UIBarStyleBlackOpaque];
[self presentViewController: picker animated: YES completion: ^{
//my comment : when this view appears, set status bar style you want here
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
}];
答案 1 :(得分:0)
这对我有用。在AppDelegates中,didFinishLaunchingWithOptions,添加以下行。
<强>夫特:强>
reply2<-.SOAP(server = s2,method = "GetQuote",action = I("http://www.webserviceX.NET/GetQuote"))
目标C:
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]
UINavigationBar.appearance().barTintColor = Config.PURPLE_APP_COLOR
UINavigationBar.appearance().barStyle = .Black
答案 2 :(得分:0)
在iOS 7.0上,条形的tintColor的行为已更改。它不再影响条形图的背景,并且如添加到UIView的tintColor属性所描述的那样。为了调整条形图的背景,请使用-barTintColor。
imagePicker.navigationBar.barTintColor = [uicolor YourColor];