问题
I need to disable the "hide animation" of the status bar when the SFSafariViewController is dismissed. After a normal Facebook login, permission request.
Because makes a bad animation on frame change..
In my storyboard the status bar is hidden and my views have a constraint "Top space to: Top layout"
回答1:
Just found the solution:
If i create and present SFSafariViewController with:
#import <SafariServices/SafariServices.h>
SFSafariViewController *sfc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:@"http://google.com"]];
sfc.delegate = self;
[self presentViewController:sfc animated:YES completion:nil];
Implementing the delegate ( SFSafariViewControllerDelegate ) method:
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
The VC is presented beautifully without status bar! And doesn't make a bad effect during dismiss.
Implementing just the delegate method works perfectly even with a SFSafariViewController called by Facebook SDK (4.6.0 from CocoaPods)
EDIT:
Doing other tests, looks like the delegate method doesn't work as expected;
But just implementing:
View controller-based status bar appearance : FALSE
In the .plist file is enough to hide the status bar in a SFSafariViewController
来源:https://stackoverflow.com/questions/32583765/at-sfsafariviewcontroller-dismiss-disable-status-bar-hide-animation-ios-9