为什么我的tableview很慢?

Kar*_*pez 0 objective-c uitableview ios

我正在制作一个装有一些NSArrays的tableview,该单元格包含两个标签和一个加载了URL图像的背景图像视图.问题是tableview的滚动速度很慢,就像冻结一样....我认为这是因为Imageview但我该怎么办?

继承了我的一些代码,你可以看到:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    // Return the number of rows in the section.


    return _Title.count;


}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    MyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    int row = [indexPath row];

    cell.TitleLabel.text = _Title[row];
    cell.DescriptionLabel.text = _content[row];
    cell.CellImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:_ImageUrl[row]]]];
    cell.CellImageView.contentMode = UIViewContentModeTop;
    cell.CellImageView.contentMode = UIContentSizeCategoryMedium;

    cell.backgroundColor = [UIColor clearColor];





    return cell;
}
Run Code Online (Sandbox Code Playgroud)

有关额外信息,此tableview提供了一个具有相同信息的Detailviewcontroller.

vir*_*ndh 5

异步加载图像(在图像进入时加载图像).查看优秀的类,例如SDWebImage https://github.com/rs/SDWebImage