Show UIView from UIActivity

73 views Asked by At

What's the best way to present a UIView on a UIViewController from inside a UIActivity. I tried the code below but that's not working. Aside from that there doesn't seem to be any documentation on this.

- (void)performActivity {
    ...
    do some stuff
    ...

    [self.activityViewController.presentingViewController.view addSubview:toast];

    [self activityDidFinish:YES];
}
1

There are 1 answers

0
user4992124 On BEST ANSWER

I managed to make it work by just retrieving the current UIView.

UIView *vc = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
[vc addSubview:toast];