Reputation: 7293
I am fairly new to Xcode, but I have run into a bit of a problem. I have a tabbed view controller, and one subtab has a UITableView. On cell click, I need TableData (a ViewController) to open up. For some reason, I just get a black screen. I then changed my code to this:
TableData *newView = [self.storyboard instantiateViewControllerWithIdentifier:@"TableData"];
[self presentViewController:newView animated:YES completion:nil];
but I get an error SIGABRT in Xcode. How do I fix this?
This works, but gives me a black screen:
TableData *view = [TableData alloc];
view.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController: view animated:YES];
Upvotes: 0
Views: 92
Reputation: 13549
Just create an identifier for the segue inside the storyboard and then use:
[self performSegueWithIdentifier:@"yourTableViewStoryboardSegueIdentifier" sender:self];
UPDATE:
Problem was most likely due to user grabbing an invalid row from his tableView. In order to just grab the row number all you need to do is:
int rowNumberSelected = indexPath.row;
As for his second code snippet, the reason its only showing a black screen is because he is not actually linking it to his viewController in the storyboard. He is simply just allocating the code. If he added subviews through the code, then they would show up but nothing from the storyboard.
Since the user is using Storyboard, its always better to just use segues and dismissals however.
Upvotes: 2