【发布时间】:2016-06-11 13:47:23
【问题描述】:
我在 Tableview 中有很多标签和印地语文本。 印地语文本通过 PHP Web 服务获取。但是在tableview中落后太多了。 滚动不流畅。忍受这么多的挂起和滞后。
这是我的cellForRowAtIndexPath 和文本转换为可读格式的代码:
- (UITableViewCell *)tableView:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *cellIdentifier;
GroupPost *post=(GroupPost*)[[arrMsg objectAtIndex:indexPath.section]objectAtIndex:indexPath.row];
if([post.postType isEqualToString:@"0"]){
cellIdentifier=@"GroupDetailCustomeCellTextOnly";
}
/////////Text Convert in URLDecode and get readble text....
NSString *unicode=[[post.postContent URLDecode] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
cell.lblPostContent.text =unicode;
return cell;
}
//This Function Use For URLDecode....
- (NSString *)URLDecode {
return [self URLDecodeUsingEncoding:NSUTF8StringEncoding];
}
- (NSString *)URLDecodeUsingEncoding:(NSStringEncoding)encoding {
return (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL,
(__bridge CFStringRef)self,
CFSTR(""),
CFStringConvertNSStringEncodingToEncoding(encoding));
}
请指导我如何使滚动非常顺畅,并从我的 Tableview 中消除挂起和滞后问题。
【问题讨论】:
-
在表格视图加载之前。从您的网络服务中创建一个完整的数组,并为数据源使用后台队列!还在主线程更新 UI ......可能它工作顺利。
-
@Pushp 贴一些代码..plz
-
你在哪里创建你的
UITableViewCell?把那个代码sn-p。 -
@DipenPanchasara in view didLoad==> [tblViewList registerNib:[UINib nibWithNibName:@"GroupDetailCustomeCellTextOnly" bundle:nil] forCellReuseIdentifier:@"GroupDetailCustomeCellTextOnly"];
-
它唯一的注册单元。你在哪里初始化你的细胞?
标签: ios uitableview uilabel