表格视图中印地语的滞后问题



我在表格视图中有很多标签文本和印地语文本。印地语文本通过PHP网络服务获取。但是在表格视图中有很多滞后。滚动不流畅。拿这么多吊和滞后。

这是我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));
}

请指导我如何非常流畅地滚动并从我的表格视图中删除悬挂和滞后问题。

dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
    // Perform long running process
    NSMutableArray *unicodeArray = [[NSMutableArray alloc] init];
    for (i = 0; i < arrMsg.count ; i++)
    {
        GroupPost *post=(GroupPost*)[arrMsg objectAtIndex:i];
        NSString *unicode=[[post.postContent URLDecode] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
        [unicodeArray addObject:unicode];
    }
});

使用 unicode 数组作为数据源。 试试让我知道发生了什么。 把这段代码放在 viewDidLoad

dispatch_async(dispatch_get_main_queue(), ^{
        [tableView reload]
    });

把这段代码放在视图确实出现

最新更新