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

  • Home
  • SEARCH
  • 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 7083807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:13:26+00:00 2026-05-28T07:13:26+00:00

I have a table view, and if a certain row is tapped, the detail

  • 0

I have a table view, and if a certain row is tapped, the detail view will show up. But how does the detail view know which row was tapped ?
So for instance, I have a MainController which displays names. If I tap “Johnny” The next screen should show a label with the string “Johnny”. How would I do that ?

[EDIT – Added code]

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ArticleView *article = [self.storyboard instantiateViewControllerWithIdentifier:@"ArticleView"];
    [article.myLabel setText:@"random"];
    [self.navigationController pushViewController:article animated:YES];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    NSDictionary *info = [json objectAtIndex:indexPath.row];
    cell.textLabel.text = [info objectForKey:@"username"];
    cell.textLabel.backgroundColor = nil;
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.detailTextLabel.backgroundColor = nil;
    cell.detailTextLabel.textColor = [UIColor whiteColor];
    cell.detailTextLabel.text = [info objectForKey:@"user_pic"];

    // Configure the cell...

    return cell;
}

ArticleView.h

@interface ArticleView : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *myLabel;       
@end

ArticleView.m

-> Synthesizing properties

  • 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-05-28T07:13:26+00:00Added an answer on May 28, 2026 at 7:13 am

    You could pass a object (i.e. the String Jonny) to the detail view controller as a property.

    @interface ArticleViewController : UIViewController
    @property (retain) ArticleView *articleView;
    @end
    
    //Don't forget to synthesize name 
    

    in the tableview controller

    -(void)tableView:(UITableView *)tableview didSelectRowAtIndexPath:(NSIndexPath)indexPath
    {
        NSDictionary *info = [json objectAtIndex:indexPath.row];
        ArticleViewController *articleViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ArticleViewController"]; 
        articleViewController.articleView = articleView;
        [self.navigationController pushViewController: articleViewController animated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table view controller which doesn't let me manually scroll to the
When I have a table view with some sections which have their own headers
In my iPhone application I have a table view. When user taps any row,
I have a table (actually a view, but simplified my example to a table)
I have a table view and some images in it .I have certain images
Hey guys, I currently have a root table view which has a toolbar at
I have an array which loads in table view, and if users taps a
I have a Table View Controller with cells. I want to update the text
I have a table view controller with custom cells. In those cells i added
I have a table view that I am customizing and I am adding a

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.