views:

80

answers:

1

So I have a uipicker view, that I have managed to load some data from my db into. I would like to update a textview, which is right above the pickerview, with each changing of the row. Is that possible?

If I don't have to, I would like to avoid pushing a button in order to show the respective text. Can I make it so that the value in the text field changes with the value of the rowselected in the pickerview, in real time? Any thoughts or code snippets would be appreciated. Thanks!

A: 

Yes, you can. just hook up the connection to the UIPicker's

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    if (component == kMyComponent)
    {
        NSString *myValue = [self.infoTypes objectAtIndex:row];
        NSLog(@"hello you selected the value: %@", myValue);
    }
}
John Wang