【发布时间】:2016-06-01 12:41:02
【问题描述】:
我有来自Web-service的印地语文本列表并想在UILabel中显示。
我正在尝试使用以下代码。
为了测试,我设置了静态文本,例如:
NSString *unicode=@"ये भी एक तमाशा है इश्क और मोहब्बत में... - ये भी एक तमाशा है इश्क और मोहब्बत में दिल किसी का होता है और बस किसी का चलता है.";
cell.lblPostContent.text = unicode;
这样的问题是...我的UITableview 滚动不顺畅。 UITableView 延迟太多。有什么方法可以用印地语正确显示此文本,并且还可以在 UITableView 上平滑滚动?
这是我的 cellForRowAtIndexPath………………
- (UITableViewCell *)tableView:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell=(GroupDetailCustomeCell*)[tableview dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell==nil){
cell=[[GroupDetailCustomeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
NSString *unicode=[[post.postContent URLDecode] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if(unicode==nil)
unicode=[post.postContent stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if([post.postType isEqualToString:@"0"]){
//textonly
cell.lblPostContent.text =unicode;
}
}
return cell;
}
【问题讨论】:
-
文本是印地语还是像 \uxxxx 这样的 unicode?span>
-
@AshishKakkad 在英文文本中工作顺利,但在印地文文本中更加滞后......
-
我有来自 web 服务的 unicode 相同的东西,即使是大文本也不会滞后,确保你有正确地重用单元格或任何其他在主线程上工作的东西,比如图像/缩略图下载等等。
-
@ChetanPrajapati 是的。我在想同样的问题可能是重复使用单元格。
-
@AshishKakkad cell=(GroupDetailCustomeCell*)[tableview dequeueReusableCellWithIdentifier:cellIdentifier]; if(cell==nil){ cell=[[GroupDetailCustomeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; }
标签: ios objective-c xcode uitableview uilabel