![](/img/trans.png)
[英]in Titanium for iPhone, how to transition from table view to detail view.?
[英]How to get text of uitextfields in table view.?
如何在iOS5的TableView中獲取文本字段的值? 我已經嘗試過標簽,但無法正常工作。
可能您使用自定義單元格。 如果要在選擇單元格時獲取文本值(創建時或在xib文件中需要為UITextField設置標簽):
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITextField *textField = [[tableView cellForRowAtIndexPath:indexPath] viewWithTag:1];
NSSTring *text = textField.text;
}
或者您可以在創建單元格時將委托設置為UITextField
在
- (UITableViewCell*)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
設置代表
UITextField *textField = [cell viewWithTag:1];
textField.delegate = self;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.