0
 - (UIViewController *)activityViewController

I created a custom UIACtivity that returns a view controller that displays a popup. This allows the user to do some editing before performing the actual activity.

With ios below 8, my background with transparency that looks like an overlay works (I can see my game underneath) but after updating to ios8, the background becomes solid color gray. I checked the UIImageView displaying my overlay image with alpha and it is set to clear. Can someone tell me why the background suddenly becomes solid? I couldn't see the view of my game underneath anymore.

Here's my code:

- (IBAction)didPressShareButton:(id)sender
{
    ...
    [_rootViewController presentViewController:[self getActivityViewController] animated:YES completion:nil];
    ...
}

The _rootViewController is the main view controller of my application.
The [self getActivityViewController] returns an instance of UIActivityViewController which includes my custom UIActivity for instagram

My InstagramUIActivity overrides this function to return a custom viewcontroller (see attached image)

- (UIViewController *)activityViewController
{
    dismissalAC = [[InstagramDismissal alloc]init];
    presentationAC = [[InstagramPresentation alloc]init];

    instagramVC = [[InstagramViewController alloc]initWithInstagramPhoto:_instagramPhoto];
    instagramVC.delegate = self;
    if ([instagramVC respondsToSelector:@selector(setTransitioningDelegate:)]) {
        instagramVC.transitioningDelegate = self;
    }

    return instagramVC;
}

dismissalAC and presentationAC are just objects that implement the UIViewControllerAnimatedTransitioning protocol so I could have my own transition animation.

When I return my custom view controller, it pops up but along with it is a view with white background. I don't know why.

View hierarchy enter image description here

cessmestreet
  • 2,298
  • 3
  • 22
  • 42

2 Answers2

1

try

instagramVC.modalPresentationStyle = UIModalPresentationOverFullScreen;

or

instagramVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
Sonia
  • 11
  • 1
0

I encountered this problem in my apps too.

Since iOS 8, Apple forbids subclassing nor customizing the subviews of an UIActivityViewController.

If you did so on your app, the app shows an overlay over your view and an empty gray list without any buttons. In this case, you must kill your app to dismiss the UIActivityViewController.

To replace this behavior, I simply creating a view (either programmatically or from storyboard) with the same layout and you can make it appear from bottom of the screen (with an animation). Ask me some example code if needed.

cdescours
  • 6,004
  • 3
  • 24
  • 30
  • Hi. Thanks for your reply but my issue is with the custom view controller that my UIActivity returns. Instead of using performActivity i returned my custom view controller. I'm having issues with that as it adds a white background. sucks! >.< do you know how to remove the white background or change it to clear? – cessmestreet Oct 13 '14 at 10:00
  • Can you post a screenshot of what you get ? Did you try to override willLayoutSubviews for instance in debugger to check for subviews, and remove it at runtime ? Or have you tried the new feature "Debug View Hierarchy" of iOS 8, which might be useful when it comes to layout debugging ? – cdescours Oct 13 '14 at 10:04
  • Hi. I attached the screenshot of what i've been getting. the gray is supposed to be an overlay. it's a gray image with transparency. When I tried to remove that, there's a white background beneath it. But i'm sure that the bg of the viewcontroller is clear. I don't know what's adding the white bg. Devices using below ios8 works fine. it's only ios8 that's doing this. – cessmestreet Oct 13 '14 at 10:16
  • I would definitely use "Debug View Hierarchy" in this case... you will be able to select the gray opaque layer, or see where your view has gone if eligible. If your image is just gray with transparency, maybe you can try to replace it with a standard UIView with a background color and alpha corresponding to your image – cdescours Oct 13 '14 at 11:47
  • hi. i tried using the debug hierarchy and the parent is the uitransitionview. would it be possible to access that? i attached the screenshot of the hierarchy – cessmestreet Oct 13 '14 at 12:37
  • Can you add the code where you present the annotation ? It seems (from your hierarchy) that the view controller from your game is not anymore on your view hierarchy... so you're seeing a gray background, because your window is black (by default) and your transparent layer come on top of it ==> giving you this gray background i think. – cdescours Oct 13 '14 at 14:45
  • Actually no. There's a white background that appears beneath it. I don't know where the white background comes from. I'll post my code for presenting the annotation. Thank you. – cessmestreet Oct 14 '14 at 02:39
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63008/discussion-between-cdescours-and-user1681701). – cdescours Oct 14 '14 at 07:28