你好同事Apple开发者!
我正在为iPhone和iPhone创建一个iOS应用程序。 iPad兼容。 UITableView
和UICollectionView
的效果是我的应用程序中非常重要的功能。
经过长时间的优化,人眼在滚动发生时无法区分。虽然,分析器仍然会发现一些问题。
UITableViewCell
对象,该用户界面是使用 .xib 文件和自动布局约束创建的。尽管如此,时间分析仪器会在将这个特定单元格出列时抱怨性能。NSString
设置为UILabel
的文字。此setter方法在方法- tableView:cellForRowAtIndexPath:
中执行。UIImage
设置为UIImageView
的图像。此方法也在方法- tableView:cellForRowAtIndexPath:
中执行,并且不会触发任何下载等。 UITableViewCell
个对象是默认大小&真的很简单。单元格的内容视图仅包含2个子视图:UILabel
和UIImageView
。
根据Apple的示例下载图片。
// Asks the data source for a cell to insert in a particular location of the table view.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Dequeues & initializes category table view cell.
CategoryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CategoryTableViewCellIdentifier];
APICategory *category = [self.categories objectAtIndex:indexPath.row];
if (category.thumbnail)
{
[cell updateThumbnailWithCategory:category];
}
else
{
if (!tableView.dragging && !tableView.decelerating)
{
[category thumbnailWithSuccess:^(UIImage *thumbnail)
{
if ([tableView.visibleCells containsObject:cell])
{
[cell updateThumbnailWithCategory:category];
}
}
failure:^(NSError *error)
{
// Handle thumbnail receive failure here!
}];
}
[cell updateThumbnailWithPlaceholder];
}
cell.category = [self.categories objectAtIndex:indexPath.row];
return cell;
}
在这种情况下使用的特定图像是.png
图像 300x300 分辨率和24 kb大小。
这些是与UITableView
和UICollectionView
的效果相关的问题。
任何人都可以解释一下,这些问题可能是什么原因?
另外,有没有办法改进它?