1

Is it possible to customise the following items in the UIActivityViewController?

  • background (I want it to be flat white)
  • icons of default items
  • the cancel button

If I iterate over the subviews none of them seems to be public, so it might be problematic with the approval even if I succeed to change them: UIActivityListView, UIActivityCancelButton

I saw some custom activity controllers but the amount of dependencies put me off immediately.
Thanks.

Puneet Sharma
  • 9,369
  • 1
  • 27
  • 33
Cristi Băluță
  • 1,295
  • 15
  • 27

2 Answers2

3

You can get at some of those with UIAppearance. The cancel button is probably the easiest. The background color works, but it shows over the entire screen. There might be a better way to do that. The icons probably can't be customised.

It's likely that you'll be able to customise some of it but not all. And doing that is probably worse than just leaving the default.

[[UIView appearanceWhenContainedIn:[UIActivityViewController class], nil] setBackgroundColor:[UIColor redColor]];
[[UIButton appearanceWhenContainedIn:[UIActivityViewController class], nil] setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
nevan king
  • 112,709
  • 45
  • 203
  • 241
0
socialActivityPopover = [[UIPopoverController alloc] initWithContentViewController:activityView];
[socialActivityPopover setBackgroundColor:[UIColor redColor]];
Come2niks
  • 359
  • 3
  • 4
  • While this code may answer the question, it would be better to include some context, explaining how it works and when to use it. Code-only answers are not useful in the long run. – ekhumoro Jan 27 '17 at 18:58