gpt4 book ai didi

ios - UITextField 上的圆角边缘

转载 作者:行者123 更新时间:2023-11-29 12:17:04 26 4
gpt4 key购买 nike

我有 3 个没有边框样式的 UITextFields。我想在代码中添加边框。我想要实现的效果是在第一个 UITextField 上有圆顶角,在第三个文本字段上有圆底角。我用于圆边的代码在这里 Round top corners of a UIView and add border

但我明白了 - 没有右边缘和角不是圆的:

example

注意:我已经设置了所有约束,这不是问题。如果我使用 UITextBorderStyleLine,右边缘不会再次变圆。

请帮忙。

最佳答案

如果您想以最简单的方式在屏幕上进行操作,请看这里>>> enter image description here

打开剪辑 subview 模式的灰色 View ,内部有 3 个标签/文本字段,以及 2 个具有 1 像素高度的黑色 View

在代码中..

self.viewCorner.layer.cornerRadius = 6;
self.viewCorner.layer.borderWidth = 1;
self.viewCorner.layer.borderColor = [UIColor blackColor].CGColor;

像这样将约束设置为灰色 View 和 2 个具有 1 像素高度的 View 之后

灰色 View

enter image description here

1 像素高度 View

enter image description here

在 iPad 模拟器上的结果

enter image description here

就这些,你可以做5分钟

关于ios - UITextField 上的圆角边缘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31755034/

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