title: How do you save the value of a UIPickerView as a string?
body: <p>I am trying to save the selection in a UIPickerView as a string, but I seem to be losing the value after I dismiss the view.  How can I retain this value?</p>
  
  <p>.m file</p>
  
  <pre><code>/*********************************/
  #pragma mark -
  #pragma mark PickerView DataSource
  //Below are the functions for the UIPicker:
  
  - (NSInteger)numberOfComponentsInPickerView:
  (UIPickerView *)pickerView
  {
      return 1;
  }
  
  //count of categories array denotes how many elements the picker will have
  - (NSInteger)pickerView:(UIPickerView *)pickerView
  numberOfRowsInComponent:(NSInteger)component
  {
      return arrCategorySelection.count;
  }
  
  //return the corresponding caregory
  - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
  {
      return arrCategorySelection[row];
  }
  
  /*********************************/
  #pragma mark -
  #pragma mark PickerView Delegate
  
  //Delegate method for the category picker
  -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
  {
      //trying to save the value as a string
      selectedCategory = [arrCategorySelection objectAtIndex:row];
  }
  </code></pre>
  
  <p>.h</p>
  
  <pre><code>@property (nonatomic, retain) NSString *selectedCategory;
  </code></pre>