I'm developing an app in which I need to show a ViewController
when I press the "OK" button in an UIAlertView
. How I can do that?
I found on here this solution: iOS Dev: Segue by pressing a button in an Alert?, but it didn't work.
xCode says:
the method: presentModalViewController is deprecated
and I found on the web that I should use the method presentViewController
.
I tried to do that but it shows me a black screen without any interaction, what's wrong? I paste here my code, maybe you can help me.
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex != alertView.cancelButtonIndex)
{
PromoViewController *pvc = [[PromoViewController alloc] init];
[self presentViewController:pvc animated:YES completion:nil];
}
}
Thank you