【发布时间】:2014-02-23 11:46:21
【问题描述】:
在我的 iOS 7.0 应用中:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
// AttemptCell is a prototype cell, currently using the "Right Detail" preset
// style and the little information accessory.
static NSString *CellIdentifier = @"AttemptCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
assert(cell != Nil);
if (cell.contentView.subviews.count == 2)
{
UILabel *attemptLabel = (UILabel*)cell.contentView.subviews[0];
attemptLabel.text = attempt.attempt;
UILabel *analysisLabel = (UILabel*)cell.contentView.subviews[1];
analysisLabel.text = [attempt analysis];
cell.tag = indexPath.row;
}
else
{
// Something has gone very wrong.
UILabel *attemptLabel = (UILabel*)cell.contentView.subviews[0];
attemptLabel.text = @"Error";
}
问题是为什么 (UILabel*)cell.contentView.subviews[1] 有时会消失导致输入错误块。
此表格视图显示了一个自定义键盘输入单元格 (UITextField),它始终显示在最后。键盘输入单元也是原型的,但具有不同的出列单元标识符。当键盘弹出并关闭时随机出现问题。键盘弹出会导致一些 AttemptCells 消失,关闭键盘会导致 AttemptCells 重新出现。
【问题讨论】:
标签: ios iphone uitableview ios7