title: How to make output dependent on UIPicker row selection
body: <p>I need a single component UIPicker to display different text and perform a different action depending on which row is selected.  I am defining the text, so it is not what the picker reads.  First, second, and third are all NSStrings.  I can't figure out the correct code to make the action dependent on the UIPicker row.  Here was my last attempt...</p>
  
  <pre><code>-(IBAction)example {
          if (UIPickerView *)examplepick didSelectRow:(NSInteger)0 inComponent:(NSInteger)0  {
          NSString *finalMessage = [[NSString alloc] initWithFormat: @"Say \"%@\"", first];
          select1.text = first;
          display.text = finalMessage;
      } else {
          if (UIPickerView *)examplepick didSelectRow:(NSInteger)1 inComponent:(NSInteger)0 {
              NSString *finalMessage = [[NSString alloc] initWithFormat: @"Say \"%@\"", second;
              select1.text = second;
              display.text = finalMessage;
          } else {
              if (UIPickerView *)examplepick didSelectRow:(NSInteger)2 inComponent:(NSInteger)0 {
                  NSString *finalMessage = [[NSString alloc] initWithFormat: @"Say \"%@\"", third];
                  select1.text = third;
                  display.text = finalMessage;
             }
         }
      }
  }
  </code></pre>