在iOS 7中,标准的qazxsw poi具有半透明的白色背景。相反,我的应用程序有一个黑暗的主题。当白色的qazxsw poi在黑暗的应用程序背景上弹出时,它看起来很糟糕。
有没有办法改变UIActivityViewController
的背景颜色?
我尝试了UIAcitivityViewController
,但这使得整个屏幕变黑,而不仅仅是像标准白色背景那样的UIAcitivityViewController
图标所占据的区域。
这应该做的伎俩:
activityVC.view.backgroundColor = [UIColor blackColor]
虽然我的解决方案似乎有点不稳定,但它适用于iOS7到iOS 8.如果某些东西突然改变,它也不会崩溃你的应用程序;
UIAcitivity
它在模拟器中的样子,例如:
我得到的只是改变了主视图的背景。试图改变其中标签的颜色没有成功。
[[UIView appearanceWhenContainedIn:[UIActivityViewController class], nil] setBackgroundColor:[UIColor greenColor]];
UIActivityViewController *aVC = [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL urlWithString:@"http://example.com"] applicationActivities:nil];
id targetView = [[[[[[[[[[[aVC.view.subviews lastObject] subviews] firstObject] subviews] firstObject] subviews] firstObject] subviews] firstObject] subviews] firstObject];
if ([targetView respondsToSelector:@selector(setBackgroundColor:)])
{
UIColor *targetColor = ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) ? [[UIColor redColor] colorWithAlphaComponent:0.3] : [UIColor redColor];
[targetView setBackgroundColor:targetColor];
}