Here's the layout:
I have a pickerView that has strings in it. I have a button and a textView. When the user selects the button, I add the selected string from the pickerView to the textView.
I see several examples of getting a string from a pickerView. However, they store it to another string and grab that string.
I can do that, but I should be able to grab the currently selected item from the pickerView.
I see
Gives me the currently selected row.
and
gives me the string that I want.
So I should be able to do this:
I get the current row, but I can't seem to get the string from the 'titleForRow' method.
I know this is a noob question, but I've been up all night banging on this program and can't think straight.
Thanks!
I have a pickerView that has strings in it. I have a button and a textView. When the user selects the button, I add the selected string from the pickerView to the textView.
I see several examples of getting a string from a pickerView. However, they store it to another string and grab that string.
I can do that, but I should be able to grab the currently selected item from the pickerView.
I see
Code:
- (NSInteger)selectedRowInComponent:(NSInteger)component
and
Code:
- (NSString *)pickerView:(UIPickerView *)picker titleForRow:(NSInteger)row forComponent:(NSInteger)component;
So I should be able to do this:
Code:
int row = [myPicker1 selectedRowInComponent:0];
NSString *myString = pickerView: myPicker1 titleForRow: row forComponent: 0;
I get the current row, but I can't seem to get the string from the 'titleForRow' method.
I know this is a noob question, but I've been up all night banging on this program and can't think straight.
Thanks!