I'm trying to make a SpriteKit app that has a button to go to my website if the user so desires to. I thought it would be a good practice to make an alert (since it's made for iOS 8, I'd use a UIAlertController
) confirming if they want to be redirected to Safari to see it.
Here's what I have in code for the method to make/present this alert so far:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Go to website" message:@"Would you like to visit DannyDalton.com? This will open Safari." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *yes = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
[self goToSite];
}];
UIAlertAction *no = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){}];
[alertController addAction:yes];
[alertController addAction:no];
[alertController presentViewController:(UIViewController*)self animated:YES completion:nil];
My problem is presenting alertController
onto the view controller, so it pops up. Any suggestions on how to make the SKView
into a UIViewController
so that alertController
can present itself onto the screen? Thank you!