我已经使用情节提要创建了一个静态 UITableView。表格视图中的每一行都包含一个文本字段,并且我为每一行指定了一个标识符。其中一个文本字段用于输入日期。我想在选择此文本字段时显示 UIDatePicker。我正在尝试将文本字段的 inputview 设置为 UIDatePicker 来完成此操作。我正在努力获取这个特定 UITableViewCell 上的 UITextField。所以这是我要去的方向:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
const NSString *birthDateCellIdentifier = @"BirthDateCell";
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString * cellIdentifier = [cell reuseIdentifier];
if(cellIdentifier isEqualToString:birthDateCellIdentifier){
/*this is the cell we're after so get pointer to cell's textfield*/
//set textfield's inputview to UIDatePicker
}
}
这是正确的方法吗?如果是这样,我如何在此单元格上找到文本字段?
谢谢!