gpt4 book ai didi

iphone - 优化圆角性能

转载 作者:行者123 更新时间:2023-12-01 16:53:33 25 4
gpt4 key购买 nike

我的UITableViewCell中有以下代码:

  [self.layer setBorderColor:[UIColor blackColor].CGColor];
[self.layer setShadowRadius:10.0];
[self.layer setCornerRadius:5.0];
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(5.0, 5.0)];
[self.layer setShadowPath:path.CGPath];
[self.layer setShouldRasterize:YES];
[self.layer setRasterizationScale:[UIScreen mainScreen].scale];

当我运行仪器并在屏幕外设置颜色-呈现黄色时,这会使单元格变为黄色。当我删除shouldRasterize时,它不会将单元格着色为黄色。有什么方法可以改善这一点?
这极大地损害了我的滚动性能。我只是想在其中设置一些阴影的圆角。

最佳答案

我在做这样的圆角:

    self.layer.shadowColor = [UIColor grayColor].CGColor;
self.layer.shadowOffset = CGSizeMake(0.05, 0.05);
self.layer.shadowOpacity = 10;
self.layer.shadowRadius = 1.5;
self.layer.masksToBounds = NO;
self.layer.shouldRasterize = YES;
[self.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[self.layer setBorderWidth: 5.0];

关于iphone - 优化圆角性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13772371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com