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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:16:36+00:00 2026-05-29T08:16:36+00:00

I am trying to create an application that has two UITableViews placed side-by-side. The

  • 0

I am trying to create an application that has two UITableViews placed side-by-side. The left one lists article categories and the right one displays article previews (kind of like flipboard’s search view).

On the left tableview’s didSelectRowAtIndexPath, I am supposed to download the article and display the previews on the right UITableView. However, I cannot seem to make this work.

My assumption is that I reload the data on the tableview before the download is finished. Any suggestions?

EDITED:

Here’s my current code:

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        if (tableView.tag == 1) 
        { 
            //if it's the left tableView (no problem here)
            NSDictionary *catDic = [[Category categories] objectAtIndex:indexPath.row];
            cell.textLabel.text = [catDic valueForKey:@"name"];
            cell.textLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:[UIFont labelFontSize]];
        }

        if (tableView.tag == 2) 
        { 
            //if it's the right tableView
            ArticlePreview *articleView = [[ArticlePreview alloc] initFlexibleHeightRowForArticleInfo:[self.articleInfos objectAtIndex:indexPath.row]]; 
            //ArticlePreview is a custom class that create the articlePreview view, 
            //articleInfos is a variable that holds the articles in core data
            [cell.contentView addSubview:articleView];
            [articleView release];
        }
    }

    return cell;
}

-(void) loadArticlePreview: (NSNumber *)_idx
{
    [Category downloadArticlesforIndex:[_idx intValue]];

    AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext *context = [delegate managedObjectContext];

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"ArticleInfo" inManagedObjectContext:context];
    [fetchRequest setEntity:entity];
    NSError *error;
    self.articleInfos = [context executeFetchRequest:fetchRequest error:&error];

    [fetchRequest release];

    [self.articlePreviewTableView reloadData]; 
    //articlePreviewTableView is the right table view identifier, hooked with IBOutlet and all
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView.tag == 1) //if it's the left table
    {
        [self performSelectorInBackground:@selector(loadArticlePreview:) withObject:[NSNumber numberWithInt:indexPath.row]];
    }
}

The problem is that the right tableview does not refresh. I think these methods are where the problem probably is.

  • 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-29T08:16:38+00:00Added an answer on May 29, 2026 at 8:16 am

    According to your code, if you dequeue a UITableViewCell, its going to use the old cell, without any modifications for the actual cell that you need. Change it to so:

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) 
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }//after this, use the tableView tag to identify.
    

    You are also adding a content view to the preview table cell. I strongly recommend you create a custom UITableViewCell class when you do this. I found that to be the only way the adding subviews works in cells and is a lot easier to manage the cells with the custom class.

    I assume you are doing the downloading in some method in the ArticlePreview. You don’t need to reload the tableView once the download is finished. Since the ArticlePreview object has been added as the cell’s subview, when the download is finished in it, call setNeedsDisplay when the view is content is downloaded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a simple Android application that has a ActivityList of
I am trying to create an application for tablets that has a main screen
I'm attempting to create a contacts application that has two main entities - person
I'm trying to create an application that will let me execute a method specified
I am trying to create an application that makes a window (external to the
I'm trying to create an application that uses the iPhone MapView (under Google Code).
I am trying to create a WPF application that takes command line arguments. If
I am currently trying to create an Android application that loops Audio from the
Trying to create a small monitor application that displays current internet usage as percentage
I'm trying to create a simple Silverlight application that involves parsing a CSV file

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.