I am using XCode 4.4 and making an app with storyboard. I want to switch to another view in a method of a view. I want to achieve the same functionality as switching view on storyboard by modal,inside the method. So far I am using the following code:
-(IBAction)xplus:(id)sender
{
x++;
if(x>30)
{
ViewController_2 *viewControllerx = [[ViewController_2 alloc] init];
[self presentViewController:viewControllerx animated:YES completion:nil];
}
}
When the view is supposed to change ie when x becomes greater than 30 a Black Screen appears instead of the required view. I personally think my code is correct but why it shows a black screen?
How can I to achieve the same functionality as switching view on storyboard by modal,inside the method ?