我有一个动态编号,UITextFields
其中都有一个inputAccessoryView
. 这是由一个UIToolbar
上面有一个按钮的。当按下这个按钮时,它会调用一个方法,但是,在这个方法中,我不知何故需要能够访问底层的UITextField
.
请有人建议这怎么可能?
// Create the toolbar controls
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(navigationBarDoneButtonPressed:)];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
// Setup the toolbar
navigationToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(10.0, 0.0, 310.0, 40.0)];
[navigationToolbar setItems:@[flexibleSpace, doneButton]];
// In a UITableView I create a number of cells which contain UITextFields....
// This is the method that gets called when a user presses the done button
- (void)navigationBarDoneButtonPressed:(id)sender
{
NSLog(@"Based on sender I need to access the underlying UITextField.");
}