Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying text from multiple components in UIPickerView
    primarykey
    data
    text
    <p>I need to display the values most recently selected in a multiple component pickerview in my label</p> <ul> <li>I have a pickerView with three components, populated by three NSMutableArrays (rowOneItems,rowTwoItems,rowThreeItems). </li> <li>I also have an NSLog statement that is correctly showing what the user last selected from the changed component. </li> <li>However, I cannot figure out how to show the most recently selected values in the label properly.</li> </ul> <p>Currently, the label takes the value from the first picker and displays it, but will not properly update the second and third values. Rather it selects the value that's in the same spot as it. For example, if all three arrays had the values of bird, dog, and cat, when I pick 'dog' in the picker view, the label will show three 'dog' values. </p> <p>What I want to do is display the values of what the user has selected in the pickerview into a label. </p> <pre><code> - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { //log which row is selected in each component //this shows the values correctly in output if(component ==1) { return NSLog(@"Selected Difficulty: %@",[rowTwoItems objectAtIndex:row]); } else if(component ==2) { return NSLog(@"Selected Duration: %@",[rowThreeItems objectAtIndex:row]); } else{ NSLog(@"Selected Type: %@",[rowOneItems objectAtIndex:row]); } //define chosen items //stuck here. tried using a if else statement as above, but of course that would only return the first value in the label NSString *chosenType = [rowOneItems objectAtIndex:row]; NSString *chosenDifficulty = [rowTwoItems objectAtIndex:row]; NSString *chosenDuration = [rowThreeItems objectAtIndex:row]; [workoutResults setText:[NSString stringWithFormat:@"%@, %@, %@", chosenType, chosenDifficulty, chosenDuration]]; </code></pre> <p>}</p> <p>Just started learning obj-c, so my apologies if this is a total newbie question. Thanks for any guidance you can give me. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload