我正在查看REMenu lib代码,并看到一个 vars 被声明为带有({ ... }); .. 看起来像是惰性评估代码的“关闭”.. 我不知道.. 有人可以解释一下吗?
self.menuWrapperView = ({
UIView *view = [[UIView alloc] init];
view.autoresizingMask = UIViewAutoresizingFlexibleWidth;
if (!self.liveBlur || !REUIKitIsFlatMode()) {
view.layer.shadowColor = self.shadowColor.CGColor;
view.layer.shadowOffset = self.shadowOffset;
view.layer.shadowOpacity = self.shadowOpacity;
view.layer.shadowRadius = self.shadowRadius;
view.layer.shouldRasterize = YES;
view.layer.rasterizationScale = [UIScreen mainScreen].scale;
}
view;
});
self.toolbar = ({
UIToolbar *toolbar = [[UIToolbar alloc] init];
toolbar.barStyle = self.liveBlurBackgroundStyle;
if ([toolbar respondsToSelector:@selector(setBarTintColor:)])
[toolbar performSelector:@selector(setBarTintColor:) withObject:self.liveBlurTintColor];
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
toolbar;
});