从 URL 显示大尺寸图像时,iOS 应用程序崩溃
<p><p>我尝试了以下用于图像缓存的库:</p>
<ul>
<li><p><strong>SDWebImage</strong></p></li>
<li><p><strong>UIImageView+AFNetworking</strong></p></li>
</ul>
<p>但应用在滚动时仍收到<strong>内存警告、崩溃和卡住</strong>。</p>
<p>我使用 <code>UITableViewCell</code> 来显示图像。</p>
<p>部分<strong>图片为 1.5 MB 或更大</strong>,所以我不确定这是问题所在还是其他问题?</p>
<p>请指导。
您的任何努力将不胜感激。</p>
<p><strong>编辑:</strong></p>
<p>我有 <code>UITableViewCell</code> 用于在 <code>UITableView</code> 中加载 <code>UICollectionViewCell</code>:</p>
<p><strong>UITableViewCell 的代码。</strong></p>
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"homecell";
HomeViewCell *cell = (HomeViewCell *);
if (cell == nil)
{
NSArray *nib = [ loadNibNamed:@"HomeViewCell" owner:self options:nil];
cell = ;
}
NSArray *arr=[ valueForKey:@"PostImage"];
;
return cell;
}
</code></pre>
<p><strong>UICollectionViewCell 的代码。</strong></p>
<pre><code>- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView1 cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"ScrollCollectionCell";
ScrollCollectionCell *cell = ;
NSString *imgKey = (IS_IPAD?@"PostImage":@"PostImage");
NSString *strImage=];
placeholderImage:];
if (==1) {
self.pageControllPostImg.hidden=TRUE;
}
self.pageControllPostImg.hidden=TRUE;
self.pageControllPostImg.numberOfPages=;
return cell;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我在一个项目中遇到过这个问题,以前的程序员每次都创建新单元格并且没有使用可重复使用的单元格。</p></p>
<p style="font-size: 20px;">关于从 URL 显示大尺寸图像时,iOS 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/38310208/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/38310208/
</a>
</p>
页:
[1]