- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这里我使用这段代码来提供渐变效果,但根本没有得到效果。
CAGradientLayer *layer2 = [CAGradientLayer layer];
NSArray *gradientColors = [NSArray arrayWithObjects:(id)[self colorWithHexString:@"3eb79d"].CGColor,(id)[self colorWithHexString:@"3fb65c"].CGColor,(id)[self colorWithHexString:@"3cb7da"].CGColor, nil];
[layer2 setColors:gradientColors];
[layer2 setFrame:cell.userBackgroundView.layer.frame];
[cell.userBackgroundView.layer insertSublayer:layer2 atIndex:0];
cell.userBackgroundView.clipsToBounds = YES;
最佳答案
试试这个
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame =cell.userBackgroundView.frame;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor clearColor] CGColor], (id)[[UIColor blackColor] CGColor], nil];
[cell.userBackgroundView.layer insertSublayer:gradient atIndex:0];
关于ios - 添加CAGradient图层但无法获得渐变效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40419443/
gradientMask.startPoint = CGPointMake(1.0, 0.0); gradientMask.endPoint = CGPointMake(1.0, 0.5); 它会出现
目前我是这样做的: final class BorderedButton: BottomNavigationButton { private let gradient = CAGradientLaye
我有一个带有圆角和阴影的 UIView,已实现并正在工作。但是 UIView 有一个无聊的背景颜色,白色。所以我想放一个渐变层作为背景。在标签、按钮下方,最重要的是,使圆角仍然出现。 CAGradie
我将 iCarousel 设置为显示一系列渐变。 // Set gradient colours var gradientColours = [ // First gradie
我正在添加一个 UIVisualEffectView 来模糊我的 View 。我 View 的背景是一个 ca 渐变层,当我添加模糊时,它只是变灰。 这是淡入淡出 View : let fad
我尝试在使用 Core Graphics 制作的饼图中添加 CAGradient 效果。事实证明,我不能,当然也不是很了解如何将它应用到作为 CGPath 一部分的 View 中...... over
您好,我在我的 View Controller 之一中使用角半径 CAGradientLayer 和边框颜色在代码中制作了一个自定义按钮,如下所示: phoneButton = [CustomButt
我正在尝试在透明图像后面添加渐变。我在 map leftCallOutAccessoryView 上执行此操作,但是无论我尝试什么,渐变层始终显示在 imageView 上方并希望它出现在其后面 这是
我有一个带有可滚动文本的 UITextView。我正在尝试对其应用渐变层,因此可见文本的底部总是略微淡出。 这是我的代码: CAGradientLayer *maskLayer = [CAGradie
我是一名优秀的程序员,十分优秀!