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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 06-18-2009, 12:09 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 2
Question Table view -> Detail view using plist?

Hi

Bit of a newbie question here. I'm trying to make a one row table view -> detail view app. The table is an alphabetical list of items and the detail view is a corresponding image of those items; ie.

User taps Apple in table view - detail view shows picture of an apple

User taps 'Back' button and is returned to the table view

User taps Bicycle in table view - detail view shows picture of a bicycle

Etc...


Am I right in thinking that I can store the list of items and corresponding images in a single plist file that is used to populate the table view and the detail view? ie.


Root (Array)

Item 1 (Dictionary)
name (String) Apple
image(String) apple.png

Item 2 (Dictionary)
name (String) Bicycle
image(String) bicycle.png

Etc...


If so, is a Navigation-based Application template in Xcode the best place to start? Or will I need to write custom code to access the plist in this way?

Any help or advice would be greatly appreciated, many thanks!
WTFWJD is offline   Reply With Quote
Old 01-02-2010, 02:41 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 39
Default Figure it out yet?

Hey,
I was just wondering if you ever figured out how to do this. I have been stuck in the same EXACT situation for months now. It would be a huge help if you or anyone else could tell me how this could be done. I have a table view, with a set of products. When I click each unique product, I want it to bring the user to a unique detail view with detailed information, and an image of the product. And finally, I hope for all the info to be stored in a plist.

Thanks!
johnhmeyer123 is offline   Reply With Quote
Old 01-06-2010, 03:29 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 2
Default

Hi,
Unfortunately not as yet. After trying a fair few approaches I just kept getting stuck. As it's a side project of mine it's kinda been on the back burner a bit. Annoyingly I know that it can be done though. I've got some time off coming up, so I'm gonna have another stab at it then. If I get any further I will let you know. And likewise if you make any progress, a nod in the right direction would be much appreciated Good luck!
WTFWJD is offline   Reply With Quote
Old 05-12-2010, 12:55 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 2
Default

any luck guys? i too am trying to do something very similar and having problems sorting out the logistics of how to do this... grrr...
PettyDesign is offline   Reply With Quote
Old 05-12-2010, 01:51 PM   #5 (permalink)
N3RD
 
Join Date: Oct 2009
Posts: 201
Default

Quote:
Originally Posted by PettyDesign View Post
any luck guys? i too am trying to do something very similar and having problems sorting out the logistics of how to do this... grrr...
How about you post some code fragments on where you're getting stuck.
Perhaps that'll draw some more attention from the community.

You did look at the sample code provided by Apple right?
Because they have many many examples on how to achieve this.
tychop is offline   Reply With Quote
Old 05-12-2010, 02:32 PM   #6 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 4,814
Default

Quote:
Originally Posted by WTFWJD View Post
Hi

Bit of a newbie question here. I'm trying to make a one row table view -> detail view app. The table is an alphabetical list of items and the detail view is a corresponding image of those items; ie.

User taps Apple in table view - detail view shows picture of an apple

User taps 'Back' button and is returned to the table view

User taps Bicycle in table view - detail view shows picture of a bicycle

Etc...


Am I right in thinking that I can store the list of items and corresponding images in a single plist file that is used to populate the table view and the detail view? ie.


Root (Array)

Item 1 (Dictionary)
name (String) Apple
image(String) apple.png

Item 2 (Dictionary)
name (String) Bicycle
image(String) bicycle.png

Etc...


If so, is a Navigation-based Application template in Xcode the best place to start? Or will I need to write custom code to access the plist in this way?

Any help or advice would be greatly appreciated, many thanks!

You've got the right idea. A plist would be one way to save your data and read it at start time. A plist will archive/unarchive dictionaries or NSArray objects. However, those dictionaries/arrays can only contain a small list of data types (including mutable or immutable variants)


NSDictionary
NSArray
NSData
NSString
NSNumber

Your image files can't be stored into a plist directly.

The simplest way to handle that is to just store the filenames of your images into your plist, and save the images as separate files in your app bundle. Then, when you need one, load it using UIImage imageNamed:

Loading your plist is really trivial. Just use the NSArray method +arrayWithContentsOfFile:

The same goes with saving your array. To save it, call the NSArray object writeToFile:atomically:


Given that you want to have a table view that links to a detail view, and then lets the user go back to the table view, a navigation based application sounds perfect. In your table view controller, you'd just use the method pushViewController:animated: to push your detail view controller, and then pop it off when you want to go back to your table view controller.



Regards,

Duncan C
WareTo
Duncan C is online now   Reply With Quote
Old 07-30-2010, 10:25 PM   #7 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 20
Send a message via Yahoo to nalin_art
Default Hi i have one Directory Problem if anyone can help Please..

i am just started learning xcode..please help.

Hi have plist with following structure..

root dictionary
a array
item 0 value
item 1 value
b array
item 0 value
item 1 value

i would like to load array a into one table only

now i don't know how to do that..

help would be much appreciated.
Thanks in advance

can any one please tell me how can i do that..
nalin_art is offline   Reply With Quote
Reply

Bookmarks

Tags
detail view, images, plist, table view

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: 266
19 members and 247 guests
ADY, Alsahir, Dani77, Desert Diva, Duncan C, F_Bryant, Grinarn, HemiMG, Herbie, jansan, linkmx, M@realobjects, macquitzon216, prchn4christ, Robiwan, smethorst, spiderguy84, twerner
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,761
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

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