Change background color in UIActivityViewController

In iOS 7, the standard one UIActivityViewControllerhas an iridescent whitish background. On the contrary, my application has a dark theme. It looks terrible when white UIAcitivityViewControllerappears on the background of a dark application.

Is there any way to change the background color UIAcitivityViewController ?

I tried activityVC.view.backgroundColor = [UIColor blackColor], but it makes the whole screen black, and not just the area occupied by the icons UIAcitivity, like a standard white background.

enter image description here

+4
source share
4 answers

This should do the trick:

[[UIView appearanceWhenContainedIn:[UIActivityViewController class], nil] setBackgroundColor:[UIColor greenColor]];
0
source

, iOS7, iOS8. , - ;

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];
}

, :

enter image description here

0

All I got was changing the background of the main view. Unsuccessfully trying to change the color of the label inside it.

let aType = NSClassFromString("_UIShareExtensionRemoteViewController") as! UIAppearanceContainer.Type
UIView.appearance(whenContainedInInstancesOf: [aType.self]).backgroundColor = UIColor.red
0
source
socialActivityPopover = [[UIPopoverController alloc] initWithContentViewController:activityView];
[socialActivityPopover setBackgroundColor:[UIColor redColor]];
-2
source

All Articles