gpt4 book ai didi

ios - 删除圆角半径 UIButton

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:40:56 27 4
gpt4 key购买 nike

我以这种方式为 UIButton 应用了边框和角半径:

self.Button3.layer.borderWidth = 10;
self.Button3.clipsToBounds = NO;
[self.Button3.layer setCornerRadius:100.0f];

我想知道是否有办法在不这样做的情况下删除它们:

self.Button3.layer.borderWidth = 0;
self.Button3.clipsToBounds = NO;
[self.Button3.layer setCornerRadius:0.0f];

我认为这只会隐藏,不会删除它们。

最佳答案

我认为这是要走的路,因为 CALayer 没有提供 API 来“删除”除 borderWidth 属性以外的边框。根据文档,CALayer 只是“绘制”边框,所以,我不认为 CALayer 包含类似 UIViewUIImage 绘制边框。

When this value is greater than 0.0, the layer draws a border using the current borderColor value. The border is drawn inset from the receiver’s bounds by the value specified in this property. It is composited above the receiver’s contents and sublayers and includes the effects of the cornerRadius property.

关于ios - 删除圆角半径 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18496243/

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