0
在一個ViewController分別位於UITableView,UITextField和UIButton。我需要通過按鈕將UITextField的文本添加到表格的單元格中。我設置壓制過程中的標誌:添加到UIButton的UITableView
- (IBAction)addingButon:(id)sender {
_addingFlag = true;
}
然後在表的方法做到以下幾點:
- (UITableViewCell *)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"dataCell";
UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:cellID];
while (true) {
if (_addingFlag && _textBox.text.length != 0) {
cell.textLabel.text = _textBox.text;
[tableView reloadData];
}
_addingFlag = false;
break;
return cell;
}
數據表滾動,只有當並出現在陌生的順序。你能告訴我如何解決它。使用Objective-C只需幾天。
謝謝!它正在工作!但我需要通過文本字段在其他單元格中推送新文本,並同時將舊文本保存在先前的單元格中。我怎樣才能做到這一點? – deMasta
您應該使用'NSArray'屬性,並使用它來存儲舊值。 –
已經完成,但無論如何感謝您的答案! :) – deMasta