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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:50:52+00:00 2026-05-16T21:50:52+00:00

Hello future friends who is gonna help me big time on this project, I

  • 0

Hello future friends who is gonna help me big time on this project,

I have these Books parsed from XML file (adopted from this post I found). First view (RootViewController) has a list of book titles in a UITable. When user clicks on one of the books, instead of viewing the books detail (BooksDetailViewController) in a second UITable, I would like the Title, Author and Summary to be in a custom view laid out in Interface Builder with UILabels and UITextView.

IBOutlet UILabel *bookTitle;
IBOutlet UILabel *bookAuthor;
IBOutlet UITextView *bookSummary;

I believe my problem has to do with RootViewController.m “didSelectRowAtIndexPath”. If I understand the example I had adapted properly (which I am not confident about), it passed the Book array into each row of the new table on my BooksDetailViewController. 

Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];

I have tried a few things to recreate  didSelectRowAtIndexPath, but I am not having much luck. Below I have the example code commented out and with my own terrible guessed code /sigh.

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

     // if(bdvController == nil)
     // bdvController = [[BookDetailViewController alloc] initWithNibName:@"BookDetailView" bundle:[NSBundle mainBundle]];
     // Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];
     // bdvController.aBook = aBook;
     // [self.navigationController pushViewController:bdvController animated:YES];


     NewBookDetailViewController *detailViewController = [[NewBookDetailViewController alloc] initWithNibName:@"NewBookDetailViewController" bundle:nil];
     Book *aBook = appDelegate.books;

     //detailViewController.aBook.title = bookTitle.text;
     //detailViewController.aBook.author = bookAuthor.text;
     //detailViewController.aBook.summary = bookSummary.text;

     [self.navigationController pushViewController:detailViewController animated:YES];
     [detailViewController release];
}

Do I actually connect the parsed data aBook.title to bookTitle (UILabel) in didSelectRowAtIndexPath of RootViewController? 

or 

Do I connect them in viewDidLoad in NewBookDetailViewController.m?

bookTitle.text = aBook.title;
bookAuthor.text = aBook.author;
bookSummary.text = aBook.summary;

What is the proper way to write the didSelectRowAtIndexPath in RootViewController for a custom view instead of a table view?

Please take it easy on me.

  • Clo
  • 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-16T21:50:53+00:00Added an answer on May 16, 2026 at 9:50 pm

    The purpose of NewBookDetailViewController is to display information about a single book, yes? So NewBookDetailViewController will need a way of being told which book it’s supposed to display.

    An easy way of doing this would be to add a property to this class to hold a reference to the Book it’s supposed to display. You would not want to pass the entire array of books to the detail view controller. How is it supposed to know which single book to display?

    Here’ how my implementation would look:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        Book *selectedBook = [appDelegate.books objectAtIndex:indexPath.row];
        NewBookDetailViewController* viewController = [[NewBookDetailViewControlleralloc] initWithNibName:@"NewBookDetailViewController"];
        viewController.book = selectedBook; // "book" is a property you'd add to NewBookDetailViewController
    
        [self.navigationController pushViewController:viewController animated:YES];
        [viewController release];
    }
    

    Here’s how you add the book property to NewDetailViewController:

    The .h file:

    @class Book;
    @interface NewDetailViewController : UIViewController {
        // other instance variables
        Book *_book;
    }
    
    @property (nonatomic, retain) Book *book;
    
    @end
    

    The .m file:

    #import "NewDetailViewController.h"
    #import "Book.h" // assuming the "Book" class is defined in Book.h
    
    @implementation NewDetailViewController
    
    @synthesize book = _book;
    
    - (void)dealloc {
        [_book release];
        [super dealloc];
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
    
        // set up your controls to display the book information
    }
    
    // other method implementations
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello all i am working on a project in which i have a webpage
From the QtConcurrent documentation : QByteArray bytearray = hello world; QFuture<QList<QByteArray> > future =
Hello! I've been programming for a long time but just started developing for android,
Hello i'm doing a application in php, and i have a list of items
Hello I've got this query to get users by email, which is an unique
Hello I have 3 flags (Italian, german, english) with the purpose to change language
For instance, I have the following string: Hello how are you today, [name]? How
Update: Originally, this post was using Books as the example entity, with Books1 ,
Hello Again my fellow programmers out there, I'm designing and programming from scratch 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.