我在UIViewController&中有tableview我在原型单元格中添加了文本。当我在表格视图中拖动文本字段区域时,我无法滚动表格视图。当我隐藏文本字段或使用户交互禁用当时提交的文本时,我能够滚动tableview。 任何决议将不胜感激。
感谢。
答案 0 :(得分:0)
如果文本字段的userInteractionEnabled
设置为YES
,并且填充entire cell
,则无法让单元格听取触摸。为了让单元格响应触摸,您需要将文本字段的userInteractionEnabled
设置为NO
。
如果您想使文本字段可编辑,则在选择单元格时,请在didSelectRowAtIndexPath:
方法中添加以下代码,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// get the reference to the text field
[textField setUserInteractionEnabled:YES];
[textField becomeFirstResponder];
}
或
你没有让textField
如此之大,以至于它涵盖了整个cell
希望这会有所帮助:)