how to return string from uipicker inside uialertview with selectedRowInComponent
I have created a uipicker in a uialertview that pops up when someone selects a UITextfield I have created this inside the
- (void)textFieldDidBeginEditing:(UITextField *)myTextField{
method, inside this I have also created a Done and Cancel button that I have hooked up to their own methods... The one that I am having trouble with is the
-(void)do开发者_如何学JAVAneButtonPressed:(id)sender{
Inside this method I want to catch what the uipicker has been set too.. however its giving me a warning...
-(void)doneButtonPressed:(id)sender{
//Do something here here with the value selected using [pickerView date] to get that value
[pickerViewPopup dismissWithClickedButtonIndex:1 animated:YES];
NSString *hexString = [NSString stringWithFormat:@"%x%x%x%x%x", [pickerViewPopup selectedRowInComponent:0], [pickerViewPopup selectedRowInComponent:1], [pickerViewPopup selectedRowInComponent:2],
[pickerViewPopup selectedRowInComponent:3]];
dateCode.text = hexString;
this throws a warning UIActionSheet may not respond to SelectedRowInComponent... any idea on how to get around this warning?
Is it possible that you have wrongly initialize pickerViewPopup to be an object of UIActionSheet?, because the is no method called selectedRowInComponent for UIActionSheet.
Check the pickerViewPopup initialization again, it might help.
精彩评论