【发布时间】:2017-12-12 17:36:49
【问题描述】:
我的 tableView 中有一个 BarButtonItem,它显示了这个警报控制器:
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];
现在,我想说的是,当我在警报控制器中按“确定”时,其中一个文本字段的文本将写入 tableview 的第一个单元格。接下来,如果我输入其他数据,我将不得不出现在 tableview 的第二个单元格中,依此类推。
按照你的说法,我该怎么做? 我需要修改这部分吗?
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
谢谢!
【问题讨论】:
-
添加单元格创建代码。然后我可以清楚地添加答案
-
@Subramanian 我没有用于创建单元格的代码,因为我无法创建它。当我点击“确定”按钮时必须创建单元格,现在我只有一个空的动态 tableView
标签: ios objective-c uitableview