I need to present a view, after UIActivityViewController will move to parent VC
...
UIActivityViewController *avvc = [[UIActivityViewController alloc] initWithActivityItems:shareItems applicationActivities:nil];
[self presentViewController:avvc animated:YES completion:nil];
I just want to clarify that the boolean value completed
represents the completion state of the individual UIActivity
. If the UIActivityViewController
is dismissed without any action, the value for activityType
will be nil
and the value of completed will be false
.
[avvc setCompletionWithItemsHandler:^(UIActivityType _Nullable activityType, BOOL completed,
NSArray * _Nullable returnedItems,
NSError * _Nullable activityError) {
if (activityType == nil) {
NSLog(@"UIActivityViewController dismissed without any action.");
} else {
NSLog(@"completionWithItemsHandler, activityType: %@, completed: %d, returnedItems: %@, activityError: %@",
activityType, completed, returnedItems, activityError);
}
}];
Swift 3 Version
avvc.completionWithItemsHandler = { (activityType, completed:Bool, returnedItems:[Any]?, error: Error?) in
if completed {
// Do something
}
}
[avvc setCompletionHandler:^(NSString *activityType, BOOL completed) {
NSLog(@"after dismiss");
//Present another VC
}];
Hope this help you.
avvc.CompletionWithItemsHandler = MyCompletionWithItemsHandler;
// ...
void MyCompletionWithItemsHandler(NSString activityType, bool completed, NSExtensionItem[] returnedItems, NSError error)
{
if (completed)
{
// Did not tap Cancel
}
else
{
// Cancel was tapped
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With