У меня есть динамическое число UITextFields
, у которого все есть inputAccessoryView
. Он состоит из UIToolbar
, на котором есть кнопка. Когда эта кнопка нажата, она вызывает метод, однако в этом методе мне как-то нужна возможность доступа к базовому UITextField
.Как получить UITextField из кнопки InputAccessoryView нажмите
Возможно, кто-нибудь посоветует, как это возможно?
// 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.");
}
Я добавил код, в котором суммируется то, что я сделал. –