Question
OBJECTIVE - C I have a table view which I created programmatically. I have 5 cells in that table view. Every time I click a
OBJECTIVE - C
I have a table view which I created programmatically. I have 5 cells in that table view. Every time I click a cell I want to go to a specific view controller. I used didSelectRowAtIndexPath and it doesn't work. Here is my code below: How to I click a specific table view cell and go to a specific view controller PROGRAMMATICALLY!
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FirstViewController *first = [self.storyboard instantiateViewControllerWithIdentifier:@"firstView"];
SecondViewController *second = [self.storyboard instantiateViewControllerWithIdentifier:@"secondView"];
ThirdViewController *third = [self.storyboard instantiateViewControllerWithIdentifier:@"thirdView"];
FourthViewController *fourth = [self.storyboard instantiateViewControllerWithIdentifier:@"fourthView"];
FifthViewController *fifth = [self.storyboard instantiateViewControllerWithIdentifier:@"fifthView"];
if (tableView==self.MyTableView)
if (indexPath.row==0) [self presentViewController:first animated:YES completion:nil];
else if (indexPath.row==1) [self presentViewController:second animated:YES completion:nil];
else if (indexPath.row==2) [self presentViewController:third animated:YES completion:nil];
else if (indexPath.row==3) [self presentViewController:fourth animated:YES completion:nil];
else if (indexPath.row==4) [self presentViewController:fifth animated:YES completion:nil];
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started