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 07-03-2010, 04:06 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Germany - Karlsruhe
Posts: 5
jcdmb is on a distinguished road
Default UITableView inside a UITableViewCell? What’s the best design?

I've not found a answer to this question anywhere, but this seems like a typical problem: I am dynamically (from a xml file) creating a view to display "Questions" I take from the XML file. I am having problems to display multiple choice questions. I am trying following approach:

Question 1
MultipleChoiceQuestion 2
--First Option
--Second Option
--Third Option
Question 3
Question 4
MultipleChoiceQuestion 5
--First Option
--Second Option
and so on...

So, my Idea is: I have a first UITableView and row for each "normal" question , and a second UITableView for each "Multiple Choice" question that should be loaded into a row from the first UITableView as I showed before.

Is this a good approach or you guys have a better design pattern for this issue?

Thanks a lot!

Last edited by jcdmb; 07-03-2010 at 04:29 AM. Reason: misrepresentation of my example
jcdmb is offline   Reply With Quote
Old 07-03-2010, 06:09 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Helsinki
Posts: 304
fiftysixty is on a distinguished road
Default

That approach is bound to run into serious problems, so I suggest scrapping it. If you have nested table views (or scroll views, more generally) then the scrolling behavior of the views will be erratic. A better solution is to use variable height table view cells: you just create the cell view to hold all the multiple choice options you need, and implement
Code:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
in your table view delegate to supply the heights of the cells.
fiftysixty is offline   Reply With Quote
Old 07-05-2010, 06:34 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Germany - Karlsruhe
Posts: 5
jcdmb is on a distinguished road
Default

Thanks for the answer, I've done that. I also used a grouped table view with one group per question, including the chosable answers for my design. Now is everything perfect. Thanks again dude!
jcdmb is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, uitableview, uitableviewcell

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: 323
6 members and 317 guests
anothermine, Chickenrig, givensur, michaelhansen, PixelInteractive, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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