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 04-23-2011, 04:01 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
KAL73 is on a distinguished road
Default Data structure question, define array at runtime?

Hi,
I am having trouble with a data structure for an iPhone project. I have an array of Record objects retrieved from an sql database. , each Record hold several strings. On the basis of the value of one of the strings, e.g. 'room', I would like to divide up the array of all the records into new smaller arrays with an array of Records for each unique type of 'room'. I am able to get an array of the unique room types at run time from the sql database with 'select distinct room from myRooms'. I understand how to populate the smaller room specific arrays if I knew the room types in advance, but users can also add new Record objects with custom room types. Is it possible to define an array at run time for each room type, if so how can I do this? Or does anyone have an idea of a different way to accomplish this? I am subdividing the array of all the Record objects so I can present data in a UITableView with a separate section for each type of room.

pseudocode of data structure for three Record objects

name = wrench
date = 3/14/11
room = workroom

name = hammer
date = 3/14/11
room = workroom

name = glass
date = 1/1/11
room = kitchen



then imagine user creates a new record:
name = toy
date = 1/2/11
room = child_room



Thank you in advance for your help.
KAL73 is offline   Reply With Quote
Old 04-23-2011, 07:41 PM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

So each group is an array? Just create a custom object with properties for name, date, and room. Then you can just create the custom object, set it's properties, then add it to an array.
Domele is offline   Reply With Quote
Reply

Bookmarks

Tags
array, data structure

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: 344
11 members and 333 guests
dansparrow, iOS.Lover, lorrettaui53, Nobbsy, oztemel, pbart, PlutoPrime, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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