我創建了一個表格,其中每個單元格都包含文本標籤和文本字段。我將這些文本字段添加爲[cell addSubview:passwordField];
,並且從視覺角度來看,它們顯示並且可編輯,等等。表格單元格子視圖迭代沒有查找文本字段
當我嘗試從文本字段中檢索輸入的值時,會出現問題。我遍歷單元格,並嘗試抓住子視圖(IE文本框),但是,我的迭代只發現文本標籤。
這裏是我使用的搜索代碼:即沒有結果
for(NSInteger i =0; i < [tableView numberOfRowsInSection:0]; i++){
NSIndexPath *path = [NSIndexPath indexPathForRow:i inSection:0];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:path];
UIView* subView = [[cell.contentView subviews]lastObject]; // I've also tried object at index here
// Anything beyond this is just matching....
我又做法是遞歸搜索子視圖,但一次。