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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:49:01+00:00 2026-06-14T17:49:01+00:00

I’m building an app that uses UICollectionView to display an array of blog posts.

  • 0

I’m building an app that uses UICollectionView to display an array of blog posts.

When the user taps on a post, a DetailView is pushed to show the post’s content.

Within the Detail View, one can see a post picture, text etc. There is also a button to show comments.

I want the user to be able to tap on the comments button and load a UITableView that will show all comments written for that post. This is the part I’m unable to implement.

I’ve created a UITableView with interface builder and connected it to the DetailView using a segue. When the comments button is tapped, I get an empty table.

On my DetailView tapping the comments button triggers this:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showComments"]) {

        NSDictionary *post           = self.detailItem;
        NSArray      *commentThread  = [post objectForKey:@"comment"];

        // how do I pass the commentThread to the UITableView at the other end of the segue?
    }
}

Any ideas how to get this done? Glad to post more code.

This is my CommentViewController.m

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"commentCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    NSDictionary *comment       = [self.commentArray objectAtIndex:indexPath.row];
    NSString     *commentText   = [comment objectForKey:@"comment_text"];
    NSString     *commentAuthor = [comment objectForKey:@"comment_author"];

    cell.textLabel.text = commentText;

    return cell;

    NSLog(@"%@", comment);
}

And CommentViewController.h

#import <UIKit/UIKit.h>

@interface CommentViewController : UITableViewController {
    NSArray *commentArray;
}

@property (strong, nonatomic) id commentArray;

@end
  • 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-14T17:49:03+00:00Added an answer on June 14, 2026 at 5:49 pm

    did you create a controller for your UITableView?

    I may not be understanding your design goal correctly so sorry if this seems like a basic answer, but if you are performing an seque, then you should initialize the tableview controller and set your datasource in some manner.

    for example, in your prepare for segue, you should have something like this:

    CommentsControllerView *myTableView = segue.destinationViewController;
    myTableView.commentsArray = self.commentsArray;
    myTableView.itemId = self.itemId;
    

    in your custom tableview controller, you might create a NSArray property to hold the comments array and setup your tableview per standard procedures. Or you would use some logic to retrieve the appropriate comments and load the tableview datasource for your new tableview. When it initializes it will have the data in it that you passed it and then it should operate just like a standard tableview using tableview delegate and datasource methods.

    does that help? hope so.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I've got a string that has curly quotes in it. I'd like to replace

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.