更改 MPMediaPickerController 导航栏的颜色,可能吗?

发布于 2024-09-14 17:26:02 字数 137 浏览 2 评论 0原文

我有一个 MPMediaPickerController,可以让用户在我的应用程序中选择他/她自己的歌曲。问题是我的应用程序始终具有“黑色”导航栏,而选择器是标准的蓝色。现在我知道不允许/不可能对选择器进行子类化,但是还有其他方法可以将导航栏更改为“黑色”吗?

I have a MPMediaPickerController that lets the user pick his/her own songs in my app. Problem is my app has the "black" navigation bar throughout and the picker is the standard blue. Now I know it's not allowed/possible to subclass the picker but is there any other way to change the navigation bar to "black"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

°如果伤别离去 2024-09-21 17:26:02

我最终做了一个类别。

@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
    UIImage *image = [UIImage imageNamed:@"CustomNavBar.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];

    self.barStyle = UIBarStyleBlack;
}

然而,这将改变所有导航栏。

I ended up doing a category.

@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
    UIImage *image = [UIImage imageNamed:@"CustomNavBar.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];

    self.barStyle = UIBarStyleBlack;
}

This will however change all navbars.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文