【发布时间】:2015-06-12 15:17:47
【问题描述】:
所以,这将是一个非常奇怪的问题。我会尽量具体。
这是我的 UITableViewController 中的一个 sn-p:
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"miscCell";
JASMiscConfigurationTableViewCell *cell = ((JASMiscConfigurationTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]);
if (cell == nil) {
cell = [[JASMiscConfigurationTableViewCell alloc] init];
}
JASMiscellaneous *misc = [((NSMutableArray *)[_miscellaneousList objectAtIndex:indexPath.section]) objectAtIndex:indexPath.row];
[cell.itemNameLabel setText:misc.itemDescription.productCostDescription];
if ([misc.itemQuantity doubleValue] > 0) {
[cell.itemQuantityField setText:[misc.itemQuantity stringValue]];
}
return cell;
}
JASMiscConfigurationTableViewCell 只是一个带有标签和文本字段的自定义 UITableViewCell。
这里的问题是:
如果我在单元格的 UITextField 中输入一个值并向下滚动页面,则输入的值会在我滚动时沿页面向下平移。当我停止滚动时,它总是设法直接在另一个行单元格的 UITextField 内休息。输入的值在离开原来的 UITextField 时并没有消失,它浮动在屏幕的最前面。这也不仅仅是一个 GUI 错误。当我遍历单元格以获取它们的值以将它们存储在对象中时,该值已转换为的 UITextField 实际上是保存该值。更奇怪的是,输入值的原始 UITextField 也仍然持有该值。当我离开屏幕并重新进入时,两个文本字段都保留了该值。
如果这听起来令人困惑,我很抱歉。这让我很困惑。如果您需要任何澄清,我很乐意提供。感谢您的帮助。
【问题讨论】:
标签: ios objective-c uitableview ipad