gpt4 book ai didi

ios - 如何使 uitextfield 变成圆形?

转载 作者:行者123 更新时间:2023-12-03 20:40:09 25 4
gpt4 key购买 nike

我想要一个圆形textField来显示圆形文本框中的数字(人数)。

我已经尝试过 cornerRadiusCAShapeLayer 建议。

最佳答案

为什么你忽略了cornerRadius?最好的解决方案是 cornerRadius 本身。

首先将文本字段的frame设置为正方形,其中width=height

[textField.layer setCornerRadius:CGRectGetWidth(textField.frame)/2];
[textField.layer setMasksToBounds:YES];

这肯定会为您创建一个圆形文本字段。

关于ios - 如何使 uitextfield 变成圆形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31152214/

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