【发布时间】:2010-02-24 00:33:25
【问题描述】:
我将一些 UITextFields、UITextViews 和 UIImageViews 作为子视图添加到 UITableCell。当我在 TextFields 或 TextViews 中输入一些文本并向上或向下滚动表格时,我遇到了一些绘图问题。每隔一个字段的文本就会与其他字段重叠,如下所示:
我正在创建这样的表单元素:
self.formFields = [[NSArray alloc] initWithObjects:
[[UITextField alloc] initWithFrame:CGRectMake(18.0, 10.0, 284.0, 22.0)],
[[UITextView alloc] initWithFrame:CGRectMake(18.0, 8.0, 284.0, 140.0)],
[[UITextField alloc] initWithFrame:CGRectMake(18.0, 10.0, 284.0, 22.0)],
[[UITextField alloc] initWithFrame:CGRectMake(18.0, 10.0, 284.0, 22.0)],
[[UIImageView alloc] initWithFrame:CGRectMake(18.0, 18.0, 284.0, 284.0)],nil];
并添加子视图:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
[cell addSubview:[self.formFields objectAtIndex:indexPath.section]];
return cell;
}
有没有办法解决这个问题?
【问题讨论】:
标签: iphone uitableview uitextfield uitextview