I have a pickerView in a popOver.
When the user selects a row from the pickerView, it should be stored into a UITextField (subject)
The method i’m having troubles is:
- (void) viewWithPickerController:(ViewWithPickerController*) viewWithPickerController didSelectValue:(NSString*) value
{ NSLog(@"selected value is: %@",value);
subject.text = [NSString stringWithFormat:@"%@",value];
NSLog(@"subject is: %@",subject.text);
}
Where value is the row of the pickerView: it logs the right value but it doesn’t set it to the textField subject, which seems to be null.
Where am i wrong?
You need to make sure your “
subject” IBOutlet is set.If you’re doing this picker view method before your XIB / view controller is instantiated, that would explain why
subjectis a nil object.How else would you be instantiating “
subject“?