我在我的应用程序中有UITableView &通常创建tableview单元格并创建任何类文件。 在我的表单元格中,我添加了UITextview,因此我的UITableView是“无法顺利滚动”。 之后我评论textview代码或用textfield /标签替换textview然后tableview滚动应该平稳。UITableview不能顺利滚动
有谁能告诉我为什么会发生这种情况? 在此先感谢。
下面是我现在在表中增加的TextView:
UITextView *txtview = [[UITextView alloc]
initWithFrame:CGRectMake(93.0,36.0,190.0,94.0)];
txtview.backgroundColor = [UIColor clearColor];
txtview.text = [NSString stringWithFormat:@"%@",strText];
txtview.contentInset = UIEdgeInsetsMake(5 ,0 ,0 ,0);
txtview.textColor = [UIColor colorWithRed:221.0/255.0 green:249.0/255.0
blue:250.0/255.0 alpha:1.0];
[cell.contentView addSubview:txtview];
[txtview release];
这里是我的手机代码:
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
cell =[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:CellIdentifier]autorelease];
else
{
NSArray *arraySubviews = [cell.contentView subviews];
for (UIView *views in arraySubviews)
{
[views removeFromSuperview];
}
}
是什么txtShout ..? – vishy 2012-02-10 08:01:21
你使用单元格重用吗?粘贴细胞生成代码在这里。 – NeverBe 2012-02-10 08:07:26
@NeverBe:发布了我的手机代码... – niks 2012-02-10 11:41:48