Reputation: 16276
when the user select an item in a pickerView and press OK button, i have to put the selected item in a UITextField, so in the IBAction of the OK button what should i put please ? thx in advance :) this is my OK button code :
-(IBAction)okButton{
[billTotal setText:@"Hi"];//the text field name is billTotal, this didn't work :(
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 480);
pickerView.transform = transform;
[UIView commitAnimations];
}
Upvotes: 0
Views: 1174
Reputation: 111
Something like this:
...
NSInteger selectedRow = [picker selectedRowInComponent:0];
billTotal.text = [NSString stringWithFormat:@"%d", selectedRow];
...
This didn't work
Check if your outlet connected to text field, and that "okButton" selector is called
Upvotes: 1