gpt4 book ai didi

iOS白色到透明渐变层为灰色

转载 作者:IT王子 更新时间:2023-10-29 07:31:26 25 4
gpt4 key购买 nike

我有一个 CAGradientLayer 插入到这个在应用程序底部弹出的小细节 View 的底部。如您所见,我已将颜色从白色设置为透明,但出现了这种奇怪的灰色调。有什么想法吗?

    // Set up detail view frame and gradient
[self.detailView setFrame:CGRectMake(0, 568, 320, 55)];

CAGradientLayer *layer = [CAGradientLayer layer];
layer.frame = self.detailView.bounds;
layer.colors = [NSArray arrayWithObjects:(id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor, nil];
layer.startPoint = CGPointMake(1.0f, 0.7f);
layer.endPoint = CGPointMake(1.0f, 0.0f);
[self.detailView.layer insertSublayer:layer atIndex:0];

这是有问题的 View :

Here is the problematic view

最佳答案

clearColor 有一个 alpha 为 0 的黑色 channel ,所以我不得不使用

[UIColor colorWithWhite:1 alpha:0]

而且效果很好。

关于iOS白色到透明渐变层为灰色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24882361/

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