Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现 CALayer 占用了大量内存。由于我有很多图像,删除图层,我已经看到它非常快:
CALayer * l = [image1 layer]; [l setMasksToBounds:YES]; [l setCornerRadius:6.0];
我可以这样做吗:
image1.layer.cornerRadius = 6.0; image1.layer.masksToBounds = YES;
会不会占内存少??有没有别的办法??
不,它不会占用更少的内存。在变量中存储对对象的引用不会复制对象 - 这两种方法是等效的,而且都是正确的。