我还添加了包含数组的 tableView 按钮,我希望当我单击添加按钮时,它会将 textField 的内容添加到将显示在 tableViewController 上的数组中
-(void) add:(UIButton *)sender{
[tableViewController._myArray addObject:headerView._searchTextField.text ];
}
最佳答案
当您更新 tableview 的数据源时,您需要重新加载 tableview 以查看更新的更改,您缺少 tableview Controller 的 reloadData mehtod :-
-(void) add:(UIButton *)sender{
[tableViewController._myArray addObject:headerView._searchTextField.text ];
[tableview reloadData]; // considering tableview is you variable holding reference of UITableView
}
关于ios - 添加按钮不在 tableView 上添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52204263/