【发布时间】:2014-05-03 11:17:09
【问题描述】:
我是 iOS 开发新手,在我的应用程序中,我需要在 heightForRowAtIndexPath 方法中计算动态表格单元格的高度。
问题是我不想在“回调”块完成之前返回值。objective-c 中有没有办法做到这一点?
这是我的方法实现:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
SDImageCache *imageCache = [[SDImageCache alloc] init];
[imageCache queryDiskCacheForKey:model.thumbnail done:^(UIImage *image, SDImageCacheType cacheType)
{
// do calculations with height etc.
// got an error "incompatible block pointer types sending"
return value;
}];
}
【问题讨论】:
标签: ios objective-c callback block heightforrowatindexpath