When I\'m using a UIActivityViewController
, after the user chooses an activity (such as Mail or Message), I can not change the text color for the status bar nor
As the UIActivityViewController presents the underlying model view controllers, we use this workaround to fix the status bar color issue:
@interface StatusBarColorApplyingActivityViewController : UIActivityViewController
@end
@implementation StatusBarColorApplyingActivityViewController
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
[super presentViewController:viewControllerToPresent animated:flag completion:^{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
if (completion) {
completion();
}
}];
}
@end
As you can see, this is just a class extending the UIActivityViewController overriding the presentViewController:animated:completion:
. When the view controller has been presented we set the status bar style via UIApplication in the completion block. Then we call the original completion block given to the method, if any.