UIView *myView = self;
CALayer *layer = [myView layer];
[layer setRasterizationScale:0.25];
[layer setShouldRasterize:YES];
我发现这个代码在某处,除了问题是当我使用它时它说没有找到方法。另外,当我输入图层。并按下转义以查看自动完成的所有属性我看到没有,所以你可以帮我找出问题,也许我没有输入什么?请提前帮助和感谢
答案 0 :(得分:3)
您必须从现有框架导入Quartz-core框架并将其添加到您的项目中,然后导入.h类。
答案 1 :(得分:1)
Hello Aspyn,
You will try this code this will help you
First of all add QuartzCore.framework from existing framework and .m file you import this framework as follow
#import <QuartzCore/QuartzCore.h>
UIView *myView = self;
CALayer *layer = [myView layer];
[layer setRasterizationScale:0.25];
[layer setShouldRasterize:YES];
[layer setContentsScale:UIViewContentModeScaleAspectFit];