代码如下:
- (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
}