I have in my tableView, a BarButtonItem that shows me this Alert Controller:
UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Feed RSS: info?"
message: @""
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Feed URL";
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Feed Title";
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Feed category";
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
}];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSArray * textfields = alertController.textFields;
UITextField * urlfield = textfields[0];
UITextField * titlefield = textfields[1];
UITextField * categoryfield = textfields[2];
}]];
[self presentViewController:alertController animated:YES completion:nil];
Now, I would like to say that when I press "OK" in the Alert Controller, the text of one of the textfields is written in the first cell of the tableview. Next, if I enter other data I will have to appear in the second cell of the tableview and so on.
According to you, how should I do it? Do I have to modify this part?
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
Thanks!