I want to push SecViewController
by selecting a row in a tableview. I am using Storyboard to implement it. This is my code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SecViewController *sec = [[SecViewController alloc] init];
[self.navigationController pushViewController:sec animated:NO];
}
But when I run this app:
it appears this situation:
Why is it so?
Change your code as following :
SecViewController *sec = [self.storyboard instantiateViewControllerWithIdentifier:@"viewControllerIdentifier"];
[self.navigationController pushViewController:sec animated:NO];
Change viewControllerIdentifier as your storyboard identifier for that view controller ..
Hope it helps..