我尝试使用以下内容显示网页google.com。出于某种原因,它没有使用google.com呈现控制器。有人可以帮忙吗?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
SFSafariViewController *vc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:@"https://www.google.com"]];
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
return YES;
}
答案 0 :(得分:1)
我认为这应该有效:
@PostConstruct
void initFieldTwo(){
field2="prefix"+field1;
}
答案 1 :(得分:0)
试试这个
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SFSafariViewController *vc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:@"https://www.google.com"]];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
return YES;
}
答案 2 :(得分:0)
如何使用SFSafariview控制器首先检查此链接。
此外,您还可以查看以下链接中的完整教程,
示例1: iOS-SafariViewControllerFinishedProject
示例2: ios-9-getting-started-with-sfsafariviewcontroller
您也可以从github下载Demo Project。 IOS9SafariViewControllerTutorial Example
修改: -
我为你做了演示 没有故事板。请查看以下链接。
<强> Safari without storyboard demo 强>
输出: -
答案 3 :(得分:0)
将SafariViewController
演示代码移至viewDidAppear
的{{1}}。如果您的RootViewController
是RootViewController
,请将其移至导航控制器UINavigationController
的{{1}}