Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions