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 05-27-2011, 09:33 AM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 16
Mystery is on a distinguished road
Question Separate and Dependent Pickers

Hey, I was wondering if it is possible to make separate pickers that are dependent The reason for this being is that there is a lot of criteria and it would be way too crammed in one picker. So can I make say, 4 separate pickers, and make them dependent on one another? How would I approach something like this?

Thanks
Mystery is offline   Reply With Quote
Old 05-27-2011, 11:04 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

you mean like that?


or X different picker?
__________________
dany_dev is offline   Reply With Quote
Old 05-27-2011, 11:12 AM   #3 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Mystery View Post
Hey, I was wondering if it is possible to make separate pickers that are dependent The reason for this being is that there is a lot of criteria and it would be way too crammed in one picker. So can I make say, 4 separate pickers, and make them dependent on one another? How would I approach something like this?

Thanks
You could, yes. If this is for an iPhone or iPod touch, though, you're going to have a tough time fitting multiple pickers on the screen. Pickers are HUGE. (I personally dislike how big they are, and wish Apple would offer a compact version.)

The logic to tie your different pickers together would belong in your view controller.

Set up all your pickers with the view controller as their delegate.

Then look for a –pickerView:didSelectRow:inComponent:
message. Since your view controller is juggling multiple pickers, you would have to look at the pickerView parameter to figure out which picker's value was changed. (Maybe set up tags on the pickers in IB so you can easily identify them?) If you want the act of changing one picker's setting to change the setting, or possible values, in your other picker(s), that logic would be triggered in your –pickerView:didSelectRow:inComponent: method. To simply change the active selection on another picker, you could use selectRow:inComponent:animated. However, you need to watch out for endless loops. If you have 3 pickers, and changing any of the 3 causes your code to change the selected item(s) in the other 2 pickers, I suspect that the system will call your –pickerView:didSelectRow:inComponent: method after your code changes the selected row.
__________________
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 05-27-2011, 11:13 AM   #4 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 16
Mystery is on a distinguished road
Default

No, I mean like in the picture attached. I mean 4 separate, single pickers that are dependent on one another. For example, one single picker would be "Honda" then you close/hide that picker, then you touch somewhere else to make another picker come up where you can select "Civic".

@Duncan, I'm going to be showing/hiding the picker depending on what you wanted to select. And yes, i personally think the pickers are very huge. I will try what you suggested with the -pickerView:didSelectRow:inComponent: method. Thanks for the suggestion.

As a side note, are there any other ways of getting input from the user without actually inputting into a text box? A text box would give the user a lot of room for invalid input. I only remember using a picker when using my iPhone, is there a list that the user can choose from?
Attached Images
File Type: jpg Screen Shot.jpg (8.0 KB, 1 views)

Last edited by Mystery; 05-27-2011 at 11:24 AM. Reason: Duncan's Post
Mystery is offline   Reply With Quote
Old 05-27-2011, 11:20 AM   #5 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Mystery View Post
No, I mean like in the picture attached. I mean 4 separate, single pickers that are dependent on one another. For example, one single picker would be "Honda" then you close/hide that picker, then you touch somewhere else to make another picker come up where you can select "Civic".
Your picture didn't load.

So you want to have a series of view controllers in increasing detail:

type of transportation

Car
--Ford
----Fusion
----Taurus
--Chevy
---- Blazer
---- Tahoe
--Volvo
--BMW
---- M3
---- X5
--Honda
---- Civic
---- Accord
--Toyota
---- Tercel
---- Corolla
--Mazda
--
Truck
Train
Boat
Plane

The first picker would let you pick a type of transportation. You'd then click a button, and go to a new view controller that would display the sub-types for that type of transportation, and tap another button. You'd go to a third view controller that would show the specific model of car/truck/plane. Is that what you have in mind?
__________________
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 05-27-2011, 11:48 AM   #6 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 16
Mystery is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
Your picture didn't load.

So you want to have a series of view controllers in increasing detail:

type of transportation

Car
--Ford
----Fusion
----Taurus
--Chevy
---- Blazer
---- Tahoe
--Volvo
--BMW
---- M3
---- X5
--Honda
---- Civic
---- Accord
--Toyota
---- Tercel
---- Corolla
--Mazda
--
Truck
Train
Boat
Plane

The first picker would let you pick a type of transportation. You'd then click a button, and go to a new view controller that would display the sub-types for that type of transportation, and tap another button. You'd go to a third view controller that would show the specific model of car/truck/plane. Is that what you have in mind?
Yes, that is exactly what I want the program to do. The pickers will be in increasing detail. The mode of transportation will always be a car. Once the user finishes selecting the car the data will be loaded to the application from a database according to the car the user selected.
Mystery is offline   Reply With Quote
Reply

Bookmarks

Tags
dependent, picker scrolling, picker view, pickers, seperate

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: 340
6 members and 334 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
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 02:13 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0