小编Kar*_*pez的帖子

为什么我的tableview很慢?

我正在制作一个装有一些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.

objective-c uitableview ios

0
推荐指数
1
解决办法
262
查看次数

标签 统计

ios ×1

objective-c ×1

uitableview ×1