使用 Objective-C 实现 SFSafariViewController 的最佳方法是什么。我目前有一个 UITableView,每个都指向不同的网站。我可以知道如何使用 Objective-C 而不是 Swift 对它们中的每一个进行编码以在 SFSafariViewController 中加载不同的网站吗?提前致谢!
最佳答案
这将适用于较新的版本,例如 10。
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://google.com"]];
if ([SFSafariViewController class] != nil) {
SFSafariViewController *sfvc = [[SFSafariViewController alloc] initWithURL:URL];
[self presentViewController:sfvc animated:YES completion:nil];
} else {
[[UIApplication sharedApplication] openURL:URL];
}
关于xcode - 使用 Objective-C 的 SFSafariViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33593670/