gpt4 book ai didi

ios - 如何隐藏SFSafariViewController?

转载 作者:行者123 更新时间:2023-12-01 18:10:08 28 4
gpt4 key购买 nike

SFSafariViewController允许网页访问Safari中存储的cookie。我想使用SFSafariViewController执行一些后台任务以利用cookie。但是,我不希望用户看到SFSafariViewController。

有没有一种方法可以隐藏SFSafariViewController并在显示SFSafariViewController时允许用户触摸屏幕?

最佳答案

Class SFSafariViewControllerClass = NSClassFromString(@"SFSafariViewController");
if (SFSafariViewControllerClass) {
id safController = [[SFSafariViewControllerClass alloc] initWithURL:[NSURL URLWithString:urlString]];

UIViewController *windowRootController = [[UIViewController alloc] init];

self.secondWindow = [[UIWindow alloc] initWithFrame:CGRectZero];
self.secondWindow.rootViewController = windowRootController;
[self.secondWindow makeKeyAndVisible];
[self.secondWindow setAlpha:0];

[windowRootController presentViewController:safController animated:YES completion:^{
[self.secondWindow.rootViewController dismissViewControllerAnimated:NO completion:NULL];
}];
}

您可以使用代码隐藏SFSafariViewControllerClass

关于ios - 如何隐藏SFSafariViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33089919/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com