thefansofjay
2015-11-30 10:32IOS block强引用循环问题,下面的代码为什么能避免强引用循环
1下面的代码为什么能避免强引用循环?
cell.thumbnailView.image = item.thumbnail;
__weak BNRItemCell *weakCell = cell;
cell.actionBlock = ^{
NSLog(@"Going to show image for %@", item);
BNRItemCell *strongCell = weakCell;
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
NSString *itemKey = item.itemKey;
// If there is no image, we don't need to display anything
UIImage *img = [[BNRImageStore sharedStore] imageForKey:itemKey];
if (!img) {
return; }
// Make a rectangle for the frame of the thumbnail relative to
// our table view
CGRect rect = [self.view convertRect:strongCell.thumbnailView.bounds
fromView:strongCell.thumbnailView];
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 第一次做app,ios提交审核被拒的问题
- ios
- 2个回答
- 为什么循环内部的条件被认为是错误的?
- ios
- c++
- 0个回答
- iOS UITableView扩展类,在其他类没有引用,为什么扩展类的方法还可以起作用?
- 扩展
- ios
- uitableview
- 2个回答
- 【微信H5】在IOS下,微信H5的底部栏问题
- ios
- 微信
- 7个回答
- iOS为什么缓存文件会过期,他什么时候过期
- ios
- 1个回答
换一换