iOS*_*oob 1 objective-c uitableview uitextfield ios
我有一个包含自定义单元格的表视图,其中包含多个文本字段.我希望在单击按钮的文本字段中输入值在cellForRowAtIndexPath中的某个位置.可能吗 ?
上图是表视图单元格中文本字段的屏幕截图.
你可以得到功能的UITextField
帮助Tag
.
假设你有3合UITextField
1 Cell
.
给Tag
到UITextField
的cellForRowAtIndexPath
方法如下方式.
[cell.TextField1 setTag:(1000 + indexPath.row)];
[cell.TextField2 setTag:(5000 + indexPath.row)];
[cell.TextField3 setTag:(9000 + indexPath.row)];
Run Code Online (Sandbox Code Playgroud)
为了让UITextField
你可以使用以下行.
// Replace 1000 with your tag value
UITextField * textField = (UITextField *)[self.tableView viewWithTag:1000];
NSLog(@"Value of textfield = %@",[textField text]);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2605 次 |
最近记录: |