我正在尝试获取选定的 cell
行标签值。我在 tableview
单元格上维护了多个 label
值。每当我选择单元格时,我都需要获取值。我没有太多代码,我正在使用以下方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
最佳答案
您只需将此代码添加到您的项目中..
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Simpletablecell *cell = (Simpletablecell *)[tableView cellForRowAtIndexPath:indexpath]; // SimpletableCell is your cell you can add your cell here like UITableViewCell..
self.lbl1.text = cell.lbl3.text;// cell.lbl3 is a label of cell.
self.lbl2.text = cell.lbl4.text;// here only two labels values get you can get other labels also
//......
//....
}
有关更多信息,请访问此 link .
关于ios - 如何使用 Objective C 获取 Tableview 选择的单元格 UILabels 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34327127/