我有一個tableview用戶進入他的社交媒體個人資料網址。我想通過點擊一個按鈕來獲得該文本框的值。 tableview是動態的。我附上了截圖供參考。我正在使用Objective C來構建一個iOs應用程序,我對此很陌生。有關如何做到這一點的任何建議?提前致謝。 !如何通過單擊按鈕來獲取tableview單元格中textfield的值?
[這是在細胞文本框]
我曾經嘗試這樣做的實現代碼如下:
NSMutableArray *Array = [NSMutableArray array];
for (int i=0; i < getMYurl.count; i++){
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: i inSection: 0];
SHOWURLTableViewCell *cellS = [table cellForRowAtIndexPath:indexPath];
NSMutableDictionary *Dict = [NSMutableDictionary dictionary];
UITextField *TextName= (UITextField*)[cellS.contentView viewWithTag:indexPath.row];
}
而且我的cellForRowAtIndexPath方法:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
cellS = (SHOWURLTableViewCell *) [tableView dequeueReusableCellWithIdentifier:@"cell"];
// cellS.labelDesc.text = mergeName;
NSString *urlText = [[getMYurl valueForKey:@"url"]objectAtIndex:indexPath.row];
cellS.labelUrl.text = urlText;
NSString *urlName = [[getMYurl valueForKey:@"url_name"]objectAtIndex:indexPath.row];
// [urlMap setValue:mergeName forKey:urlText];
cellS.urlNameET.tag = 100;
}
的NSMutableArray *陣列= [NSMutableArray的數組];對於(int i = 0; i
顯示您的cellforRow方法 –
結束輸入後,您應該必須將textfiled的文本存儲在任何數組變量(索引明智)中。因爲tableview會破壞tableview單元格,而不會顯示在屏幕上。 –