gpt4 book ai didi

具有渐变背景的 iOS UITextField

转载 作者:行者123 更新时间:2023-11-29 04:39:32 25 4
gpt4 key购买 nike

我想要一个带有渐变背景的 UITextField,以使我的项目选项之一在视觉上更具吸引力。

我试图子类化 UITextField 类并重写 initWithFrame,但它不起作用。我以前从未尝试过对 UIControl 进行子类化,所以我想我错过了一些东西。

有人可以帮我吗?预先感谢您!

最佳答案

这应该有效:

textView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"gradient.jpg"]];

但是您必须将控件更改为 TextView。

关于具有渐变背景的 iOS UITextField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10598915/

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