On the settings page, I want to include three links to
I've searched this site and the web and my documentation and I've found nothing that is obvious.
NOTE: I don't want to open web pages within my app. I just want to send the link to Safari and that link be open there. I've seen a number of apps doing the same thing in their Settings page, so it must be possible.
Here's what I did:
I created an IBAction in the header .h files as follows:
- (IBAction)openDaleDietrichDotCom:(id)sender;
I added a UIButton on the Settings page containing the text that I want to link to.
I connected the button to IBAction in File Owner appropriately.
Then implement the following:
Objective-C
- (IBAction)openDaleDietrichDotCom:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.daledietrich.com"]];
}
Swift
(IBAction in viewController, rather than header file)
if let link = URL(string: "https://yoursite.com") {
UIApplication.shared.open(link)
}