Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9297923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:11:34+00:00 2026-06-18T22:11:34+00:00

Im currently creating an app with tableview now what i like to happen is

  • 0

Im currently creating an app with tableview now what i like to happen is when i click the first row it will show view1 and when i click the 2nd row it will show view2. How can i do this?

i tried to use an if else statement id my didSelectRowAtIndexPath but it did not work here is my piece of code

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

int EntryIndex = [indexPath indexAtPosition:[indexPath length]-1];

{
    AboutViewController *aboutView = [[AboutViewController alloc]init];
    aboutView.getId4 = [[contentArray objectAtIndex:EntryIndex]objectForKey:@"title"];
    aboutView.aboutofficeId = getId3;
     [self.navigationController pushViewController:aboutView animated:YES];
}
else
{
    DepartmentsViewController *deptView = [[DepartmentsViewController alloc]init];
    deptView.getId5 = [[contentArray objectAtIndex:EntryIndex]objectForKey:@"title"];
    deptView.deptoffice = getId3;
    [self.navigationController pushViewController:deptView animated:YES];
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:11:35+00:00Added an answer on June 18, 2026 at 10:11 pm

    NOTE : You want to create and display UIView, so i putted here UIView Not UIViewController.

     - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        {
    
            if(indexPath.row == 1)
            {
                UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake("AsYouWnat")];
                view1.backgroundColor = [UIColor redColor];
                [self.view addSubview:view1];
            }
            else if(indexPath.row  == 2)
            {
                UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake("AsYouWnat")];
                view2.backgroundColor = [UIColor redColor];
                [self.view addSubview:view2];
            }
            .
            .
            .
            .
            .
            ////////// As Your Row In Table
            else
            {
                UIView *viewN = [[UIView alloc] initWithFrame:CGRectMake("AsYouWnat")];
                viewN.backgroundColor = [UIColor redColor];
                [self.view addSubview:viewN];
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently creating a iOS 5 iPad app where there will be heavy network
I am currently creating a point and click app for the iphone using cocos2d.
I'm currently creating my first android app and I've a simple class 'Player' I
I'm currently creating a web-based app that will be used in conjunction with PhoneGap
I'm creating an app supporting versions 2.1 and up to what's currently available. Now,
I am currently creating my first app for a personal project and I'm having
I am currently creating my first project using Google App Engine in Eclipse. For
I am currently creating an app and would like to create a demo version
I'm currently creating an iPhone app (Xcode 4.3.1, IOS 5) that could use Bluetooth
I am currently creating an iOS app, which connects to a database and asynchronously

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.