gpt4 book ai didi

iOS - 设置 UIButton 背景颜色只为角落着色

转载 作者:技术小花猫 更新时间:2023-10-29 10:16:13 25 4
gpt4 key购买 nike

我正在尝试通过更改颜色来自定义我的按钮,但是当我使用其中之一时:

self.loginButton.layer.backgroundColor = [UIColor colorWithRed:0.0 green:157.0/255.0 blue:223.0/255.0 alpha:1.0].CGColor;

self.loginButton.backgroundColor = [UIColor colorWithRed:0.0 green:157.0/255.0 blue:223.0/255.0 alpha:1.0];

我得到的是这个结果:

enter image description here

我想做的是将白色更改为蓝色,知道我做错了什么吗?

最佳答案

您正在使用一个圆形的矩形按钮,它非常丑陋,而且很难定制。

您可以创建自定义类型按钮并使用背景图像,或创建自定义类型按钮并圆角并自行设置图层的背景颜色。

如果你真的想玩得开心,有一个很好的教程 here它可以使用图层为您提供任意大小的渐变类型按钮,不需要图像文件。

关于iOS - 设置 UIButton 背景颜色只为角落着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9979057/

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