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 10-18-2009, 11:46 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 10
Exclamation UITableViewCell Selection, Return Boolean Value

Hello All,

I have a table view with 2 levels, the first with 4 rows and a disclosure accessory on each, and the second with a list of values. I want to be able to select a row, which then loads the corresponding list. You can then select values which will result in a checkmark in the cell .

When you return to the first level with the 4 objects, I want the selected values to show up as strings underneath the object title string within the same cell, like a detail string.

I have been able to populate the table view correctly, and add and remove checkmarks to each 2nd level cell when selected.

The first problem: when you scroll down, the checkmarks rearrange themselves at random. Second: I can't find any documentation to use a table view as a picker.

I have used arrays to populate the tableviewcells. Is it possible to assign each object within that array a boolean value for being checked or not?
Should I use a plist and for each object, i'll have its title and boolean checked value.

Any assistance you could give me is greatly appreciated.
trojanvillage is offline   Reply With Quote
Old 10-19-2009, 08:35 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 10
Default

does anyone have any ideas?
trojanvillage is offline   Reply With Quote
Old 10-19-2009, 10:51 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 10
Default

i m not sure if i understood exactly what u asked, but may be u can use section headers instead of table cells. u can put buttons to section headers and when a button is clicked, selected section's cells can be populated with appropriate data. (for example i used it for football competitions, section headers had names of countries, and all sections have 0 cells, and when a country is clicked, clicked section's number of cells set and cells are loaded with the selected country's competitions.)

if u think this can solve ur problem, i can explain more detailed.
xenep is offline   Reply With Quote
Old 10-19-2009, 11:37 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 10
Default

Well, I really wanted to stick to the basic populated UITableView if possible. I can select a Cell, which will then checkmark the cell. You can select it a second time, and it will uncheckmark.

The problem is, there are 4 sections with 6 or so rows each. When you check a row at the top, scroll down, and then back up, the checkmark is located on a different row. I know this is due to reusing cells. That's fine, but I need a way and example of how to save which cells are selected and checkmarked and possibly assign it to the String in each row (cell).

Then, I want to use the string in each checkmark Cell in another view. I thought this would have been easy to execute. After scouring the internet for ideas, i'm left with dead ends.

Thanks for your help.
trojanvillage is offline   Reply With Quote
Old 10-19-2009, 12:43 PM   #5 (permalink)
iPhone Developer
 
Join Date: Sep 2008
Location: Canada
Posts: 149
Default

You just need to store the checkmarked state somewhere. Several ways to do that.

One way:

You can use one array of NSNumber's (which a little bit of math) or two, it's up to you. The only trick is that since you can't set an NSNumber's value, when someone checks a table cell, you'll have to replace the array entry with a new NSNumber object.

Another way:

Instead of storing a string for each cell, store a struct containing a string and a bool.

Etc....
__________________
from ChewyApps.com
Henning is offline   Reply With Quote
Old 10-20-2009, 07:04 PM   #6 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 10
Default

Can you write an example of the struct method?
trojanvillage is offline   Reply With Quote
Reply

Bookmarks

Tags
boolean, cell, nsmutablearray, 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: 235
15 members and 220 guests
ADY, AragornSG, Dani77, Dattee, Duncan C, fkmtc, HDshot, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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