gpt4 book ai didi

ios - 如何在带有 cornerRadius 的 UIView 上绘制 1 像素宽的平滑边框?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:33 26 4
gpt4 key购买 nike

这是我用来设置 UIView 边框的代码:

self.layer.borderColor = [UIColor whiteColor].CGColor;
self.layer.cornerRadius = self.bounds.size.height/2;
self.layer.borderWidth = 0.5;

这就是它的样子:

enter image description here

水平部分是正确的,但是有没有办法让弯曲部分“更平滑”,同时在视网膜设备上保持 1 像素的线宽?它现在看起来非常锯齿。

谢谢!

最佳答案

您应该将 self.layer.borderWidth = 0.5; 更改为 self.layer.borderWidth = 1.f;

关于ios - 如何在带有 cornerRadius 的 UIView 上绘制 1 像素宽的平滑边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25724210/

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