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 > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 11-20-2011, 02:10 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 7
devcoder is on a distinguished road
Thumbs up How can i configure the Sections and rows in my TableView to display Sub Levels

I want to display the data in a way like this in my TableVIew. I have 3 sets of arrays

1. Category Arrays
2. Album Arrays
3. Track Arrays

Category1 may contains many Albums and each Album contains many tracks .... Category2 may contains many Albums and each Album contains many tracks ....

how can i configure the section and rows in my tableView. Any one give me an idea how can i do it

1.CATEGORY 1

ALBUM1

Track 1

Track 2

ALBUM2

Track 1

Track 2

2.CATEGORY 2

ALBUM1

Track 1

Track 2

.... and son on



Last edited by devcoder; 11-20-2011 at 03:06 AM.
devcoder is offline   Reply With Quote
Old 11-20-2011, 07:24 AM   #2 (permalink)
Registered Member
 
ebender001's Avatar
 
Join Date: Mar 2010
Location: Missouri
Age: 57
Posts: 70
ebender001 is on a distinguished road
Default

Quote:
Originally Posted by devcoder View Post
I want to display the data in a way like this in my TableVIew. I have 3 sets of arrays

1. Category Arrays
2. Album Arrays
3. Track Arrays

Category1 may contains many Albums and each Album contains many tracks .... Category2 may contains many Albums and each Album contains many tracks ....

how can i configure the section and rows in my tableView. Any one give me an idea how can i do it

1.CATEGORY 1

ALBUM1

Track 1

Track 2

ALBUM2

Track 1

Track 2

2.CATEGORY 2

ALBUM1

Track 1

Track 2

.... and son on
There is a UITableViewDelegate method for that:
Code:
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
Ed
ebender001 is offline   Reply With Quote
Old 11-20-2011, 09:12 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 7
devcoder is on a distinguished road
Default

i doesn't means the Indenting .... What i want to know is how can i add and delete the rows if appropriate rows are selected ... like expanding and collapsing ...
devcoder is offline   Reply With Quote
Old 11-22-2011, 08:56 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,002
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by devcoder View Post
i doesn't means the Indenting .... What i want to know is how can i add and delete the rows if appropriate rows are selected ... like expanding and collapsing ...
So you want each category to be empty initially, with a disclosure triangle on it? Then, when the user taps on it, you want it to "open up" and display the data for that category?

We do something very much like that in the help system for our apps "Kevin and Kell" and "Save My Place". (Save My Place is only $0.99. You might want to download it to see if its help (info) screen is doing what you want)

What we do is create an array of booleans "section is open" for each section of items.
If a section is not open, we return 1 in response to the numberOfRowsInSection data source call for that section.
(The only row is the section heading with the disclosure button.)

If the user taps a section, we change a flag to indicate that that section is now "open," and insert the extra rows for that section into the table view using the insertRowsAtIndexPaths:withRowAnimation: method.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 12-02-2011, 04:14 AM   #5 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

here a good tutorial about expanding\collapsing on UITableView
Expanding/Collapsing TableView Sections | Cocoanetics
__________________
dany_dev is offline   Reply With Quote
Old 12-28-2011, 02:20 PM   #6 (permalink)
Registered Member
 
Join Date: Apr 2009
Location: michigan
Posts: 197
michelle is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
So you want each category to be empty initially, with a disclosure triangle on it? Then, when the user taps on it, you want it to "open up" and display the data for that category?

We do something very much like that in the help system for our apps "Kevin and Kell" and "Save My Place". (Save My Place is only $0.99. You might want to download it to see if its help (info) screen is doing what you want)

What we do is create an array of booleans "section is open" for each section of items.
If a section is not open, we return 1 in response to the numberOfRowsInSection data source call for that section.
(The only row is the section heading with the disclosure button.)

If the user taps a section, we change a flag to indicate that that section is now "open," and insert the extra rows for that section into the table view using the insertRowsAtIndexPaths:withRowAnimation: method.
I'm having a bit of a problem trying to visualize what your trying to do.

We came up with some lazy load tableviews that might give you want you want in a little bit different ui then what you are describing.

Lazy load facebook album cover images - Life in The Clouds
__________________
Help us build great applications or let us make your applications exceptional. find us on Facebook
michelle is offline   Reply With Quote
Reply

Bookmarks

Tags
ios

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: 411
13 members and 398 guests
bignoggins, djqbert, epaga, flamingliquid, jcdevelopments, leighec68, LunarMoon, markolo, mrtdmb, omagod, pinacate, revg, taylor202
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,861
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

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