创建这样一个按钮而无需使用 .png 并将其设置为背景的最简单方法是什么?
最佳答案
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = self.rem.bounds;
gradient.cornerRadius=7.0f;
gradient.colors = [NSArray arrayWithObjects:
(id)[[UIColor blueColor] CGColor],
(id)[[UIColor blueColor] CGColor], (id)[[UIColor whiteColor] CGColor],nil];
gradient.opacity=0.7f;
[self.rem.layer insertSublayer:gradient atIndex:0];
self.rem.layer.cornerRadius=7.0f;
[self.rem.layer setBorderWidth:0.50f];
试试这个并导入QuartzCore
rem是UIButton
的导出
我希望这能解决你的问题
关于iphone - 如何创建一个有光泽的渐变 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15831312/