UIPickerView and multiple text fields, iOS
UIPickerView and multiple text fields, iOS
- Subject: UIPickerView and multiple text fields, iOS
- From: Chris Paveglio <email@hidden>
- Date: Fri, 20 Sep 2013 09:54:18 -0700 (PDT)
How can I use a picker view to select something and while the picker view is still displayed, have it update multiple text fields?
Conceptual setup: I have a dictionary of values like {A:1, B:2, C:3}. The keys (text values) are what the user is going to pick from the list. The numeric values are the corresponding value. User picks value A, and then the number 1 goes into another data field (numbers will actually be hard to remember floats).
I can successfully show a picker when user enters the text field for the text value. It updates the text field properly. I can "get" the numeric value from the dictionary, but how do I get that other text field to update when the user scrolls the picker list?
Currently I have my text field subclassed and it's the <UIPopoverControllerDelegate, UIPickerViewDataSource, UIPickerViewDelegate> for the picker. I'm using this to try to force updating of the 2nd (numeric) field as the picker is scrolled, but since the picker is in the foreground it's crashing, I figure since it won't let other messages through till it's dismissed. I don't want to wait till the picker is dismissed to display the value.
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
[selfsetText:[[[[PaxValueStoresharedStore] allPaxValues] allKeys] objectAtIndex:row]];
NSNumber *thePax = [[[PaxValueStore sharedStore] allPaxValues] objectForKey:[self text]]; //returns nsnumber
NSLog(@"%@", thePax); //this works fine until next
[[self delegate] performSelector:@selector(setPaxFieldValue:)
withObject:thePax];
}
Thanks
Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden