Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-16-2010, 10:59 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 59
slowman21 is on a distinguished road
Default XML Parsed data into a Custom View with UILabel instead of UITableView

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.

Code:
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.

Code:
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.

Code:
- (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?
Code:
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
slowman21 is offline   Reply With Quote
Old 09-16-2010, 11:48 AM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 59
slowman21 is on a distinguished road
Default

*UPDATE*
hmm... after researching some more it seems I am closer with this...
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Book *aBook = [appDelegate.books objectAtIndex:indexPath.row]; detailViewController.bookTitle.text = aBook.title; detailViewController.bookAuthor.text = aBook.author; detailViewController.bookSummary.text = aBook.summary; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release];
}
But I am still missing something...?
slowman21 is offline   Reply With Quote
Old 09-16-2010, 12:03 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 59
slowman21 is on a distinguished road
Default

I think Alex from this post solved my problem. Thanks all.

XML Parsed data into a Custom View with UILabel instead of UITableView - Stack Overflow
slowman21 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 313
16 members and 297 guests
2ndSegment, cayladv57, cgokey, dermotos, djohnson, Domele, Hamad, heshiming, linkmx, markuschow, pungs, Rudy, Sloshmonster, teebee74, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:57 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0