【发布时间】:2019-05-31 20:37:04
【问题描述】:
我有一个像这样的 ivar 类:
@interface MCProgressBarView() {
CGFloat minimumForegroundWidth;
CGFloat availableWidth;
}
稍后在代码中,我有这个:
dispatch_async(dispatch_get_main_queue(), ^{
CGRect frame = _foregroundImageView.frame;
frame.size.width = roundf(minimumForegroundWidth + availableWidth * valor);
_foregroundImageView.frame = frame;
[self layoutIfNeeded];
});
后面代码的minimumForegroundWidth 行显示了这个错误:
Block 隐式保留'self';明确提及“自我”以表示 这是预期的行为
我知道如何为属性解决这个问题,但是 CGFloat ivars 呢?
【问题讨论】:
标签: objective-c objective-c-blocks ivar