您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页iOS | App跳转Safari直接打开指定的网页

iOS | App跳转Safari直接打开指定的网页

来源:伴沃教育

代码如下:

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIButton *btnSkip = [UIButton buttonWithType:UIButtonTypeCustom];
    btnSkip.frame = CGRectMake((self.view.frame.size.width - 280)/2, 30, 280, 50);
    btnSkip.backgroundColor = [UIColor redColor];
    [btnSkip setTitle:@"测试跳转到Safari" forState:UIControlStateNormal];
    [btnSkip setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btnSkip addTarget:self action:@selector(skipToSafari) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnSkip];
    
    
}

- (void)skipToSafari
{
    // app跳转打开safari 跳转打开指定设置的网页
    [[UIApplication sharedApplication] openURL:[NSURL 
}

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务