At SFSafariViewController dismiss, disable status bar hide animation [iOS 9]

安稳与你 提交于 2019-12-12 18:35:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!