【发布时间】:2017-08-16 09:06:21
【问题描述】:
我有一个表格视图,用户可以在其中输入他的社交媒体个人资料网址。我想在单击按钮时获取该文本字段的值。表格视图是动态的。我附上了截图供参考。我正在使用 Objective C 来构建一个 iOs 应用程序,我是新手。关于如何做到这一点的任何建议?提前致谢。
[![这是单元格中带有文本字段的表格视图]
我已经试过了:
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 Array = [NSMutableArray 数组]; for (int i=0; i )[cellS.contentView viewWithTag:indexPath.row]; }
-
显示你的 cellforRow 方法
-
您应该在结束输入后将 textfiled 的文本存储在任何数组变量中(索引方式)。因为 tableview 破坏了 tableview 单元格,而它没有显示在屏幕上。
-
@PramodTapaniya 哦,我试试。顺便说一句,谢谢..
-
你能解释一下 getMYurl dict 中的 url 和 url_name 是什么吗?
标签: ios objective-c iphone uitableview