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 6977963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:41:39+00:00 2026-05-27T17:41:39+00:00

I have a tableview where each cell is populated with dynamic data from an

  • 0

I have a tableview where each cell is populated with dynamic data from an array. From here, when the user selects a row, I want to push the particular data from that cell to a ViewController so that it can eventually be used for a POST request. Now I know this code on my tableviewcontroller will just display the data

- (void)tableView:(UITableView *) tableView didSelectRowAtIndexPath:(NSIndexPath *__strong)indexPath {
    DetailGameController *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];
    [self.navigationController pushViewController:detail animated:YES];
    NSUInteger row = [indexPath row];
    detail.rowNum.text = [photoTitles objectAtIndex:row];

}

but how do I actually use the data?

Here is a snippet of what I have (the actual code has multiple NSMutableArrays but I only included one):

     - (void)viewDidLoad
    {

        [super viewDidLoad];
        photoTitles = [[NSMutableArray alloc] init];
 NSURL *url = [NSURL URLWithString:@"http://localhost/test.php"];
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
    [request setPostValue:dataCenter.data forKey:@"name"];
    [request setDelegate:self];
    [request startAsynchronous];

}
- (void)requestFinished:(ASIFormDataRequest *)request
{

    NSString *responseString = [request responseString];

    NSDictionary *dictionary = [responseString JSONValue]; 
    NSArray *photos = [[dictionary objectForKey:@"photos"] objectForKey:@"photo"];

    for (NSDictionary *photo in photo) {
        NSString *photo = [photo objectForKey:@"photo"];
        [photoTitles addObject:photo];
    }    
}

-(NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
    return [photoTitles count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath   {


    static NSUInteger const kPhotoTitleTag = 2;
    UILabel *photoTitleLabel = nil;

 static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
                             SimpleTableIdentifier];
    if(cell == nil){


        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: SimpleTableIdentifier];

        photoTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 25, 170, 14)];
        [cell.contentView addSubview:photoTitleLabel];
}else {
        photoTitleLabel = (UILabel *)[cell.contentView viewWithTag:kPhotoTitleTag];
}
NSUInteger row = [indexPath row];

    photoTitleLabel.text = [photoTitles objectAtIndex:row];
    return cell;

Any help in putting me in the right direction would be awesome. Let me know if anything isn’t clear.

  • 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-27T17:41:39+00:00Added an answer on May 27, 2026 at 5:41 pm

    Why pass the index of the row?
    Pass the information the other controller need to use.

    DetailGameController *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];
    NSUInteger row = [indexPath row];
    detail.someProperty = [photoTitles objectAtIndex:row];
    detail.someOtherProperty = // other interesting elements ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITextField in each cell of my tableview. I want to set
I have a tableview with each cell loaded from a xib. It is in
On each cell of my table view I want to have a bar that
I have table view which is populated from an array grabbed from a url.
I have 3 segmented controls in each cell of a tableview on an iPad.
I have tableview with some names on each cell , how can i get
I am loading a tableview. Each cell of my tableview should have varying heights
I create UITableView and I have 3 cells , so each cell should push
I have a tableView with custom cells in it, each cell has a UISlider
I have a RSS feed reader app which each cell collets a title from

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.