UITableview 滚动不流畅
我的应用程序中有 UITableView &已通过创建任何类文件正常创建了表格视图单元格。 在我的表格单元格中,我添加了 UITextview,因为我的 UITableView 是“滚动不顺畅”。 在我注释文本视图代码或用文本字段/标签替换文本视图之后,表格视图滚动得尽可能平滑。
谁能告诉我为什么会发生这种情况? 提前致谢。
这是我在表中添加文本视图的方法:
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];
}
}
I have UITableView in my application & have created tableview cell normally with creating any class file.
In my table cell i'm adding UITextview due to which my UITableView is " not scrolling smoothly ".
After I comment textview code or replaces textview with textfield/Label then tableview scroll as smoothly as it should .
Can anyone tell me why this is is happening?
Thanks in advance.
Here is how i'm adding textview in table :
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];
Here is my Cell generation code :
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];
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)