【问题标题】:MPMediaPickerController background colors of icons, when aren´t selectedMPMediaPickerController 图标的背景颜色,未选中时
【发布时间】:2014-03-02 23:04:40
【问题描述】:

我需要更改 MPMediaPickerController 中图标的灰色颜色,当它们未被选中且背景不透明,如褪色时,我也需要将其删除。

我正在使用 ios7.1 和下一个代码在我的 viewController 上显示 MPMediaPickerController 元素。

- (IBAction)addSongs:(id)sender {

  MPMediaPickerController *picker = [[MPMediaPickerController alloc]
                                  initWithMediaTypes:MPMediaTypeMusic];

  picker.delegate = self;
  picker.allowsPickingMultipleItems = YES;

  [self presentViewController:picker animated:YES completion:nil];

}

AppDelegate 上的这段代码

- (BOOL)application:(UIApplication *)application
      didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {



  [[UIView appearance] setTintColor:[UIColor whiteColor]];

  return YES;
}

示例:

【问题讨论】:

  • 尝试获取选择器的视图并尝试更改 alpha 设置。
  • @GonzaloBahamedez 我已经在 appdelegate 中设置了我的标题位置,如下所示 [[UITabBarItem 外观] setTitlePositionAdjustment:UIOffsetMake(0.0, -12.0)];但现在在另一个视图控制器中,我需要默认位置的标签栏项目标题???

标签: ios objective-c ios7 mpmediapickercontroller


【解决方案1】:

这个和MPMediaPickerController customize the colors of the labels and icons一样

.... 在应用委托中:

 [[UIView appearance] setTintColor:[UIColor blueColor]]; 

该命令使用 sillohouette 图标设置选项卡栏、工具栏等所有内容的色调......您的选项卡栏似乎在黑暗的窗口背景上是半透明的......我在我的应用程序中也使用了 mpmediapickercontroller 和自从迁移到 IOS 7 后,我使用默认设置获得了全白背景。我相信这是您的 windows.backgroundcolor 我的设置为白色。

【讨论】:

  • 不,不一样,这不起作用,这种方式适用于所选图标的颜色,最糟糕的是,在 ios 7.1 的最后一次更新中,这不再起作用了,现在选中的项是绿色的,就是忽略了句子的颜色:[[UIView外观] setTintColor:[UIColor blueColor]];我不明白。
  • Gonzalo 我理解你的沮丧,MPMediaController 并没有真正的控件来允许程序员改变和修改它的外观。我怀疑苹果希望它的外观和感觉像音乐应用程序,苹果可以随时改变外观。另一方面,有足够的命令允许您选择媒体库中所有可用的媒体,以便您可以制作自己的选择器。关于暗灰色,媒体库中是否有任何歌曲我怀疑它的行为方式是因为没有音乐。
  • 你能给我一些关于如何创建我自己的选择器的参考,给你赏金,然后关闭问题吗?
  • 当然 - 您可以使用名为 MPMediaQuery 的类将媒体/歌曲提取到数组中,然后使用 tableview 作为选择器。 - 看看这个页面 - developer.apple.com/library/ios/documentation/Audio/Conceptual/…
  • @Paulo 如果我想在 ios 8 或更高版本的 MPMediaPickerController 中设置背景颜色该怎么办
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-12
  • 1970-01-01
  • 1970-01-01
  • 2020-02-11
相关资源
最近更新 更多