-->

如何设置的iOS的UITextField边框颜色? (RubyMotion +的iOS)(How

2019-10-20 16:06发布

如何使用RubyMotion设置文本框的边框颜色?

示例代码:

textField = UITextField.alloc.init
textField.borderStyle = UITextBorderStyleLine

边框颜色显示为苹果默认的颜色; 我希望它是红色的。

这是使用RubyMotion,而不是Objective-C的

Answer 1:

使用Quartz框架。

在你的Rakefile:

app.frameworks << 'QuartzCore'

要设置层属性:

textField.layer.borderColor = UIColor.redColor.CGColor
textField.layer.borderWidth = 1
textField.layer.masksToBounds = true


文章来源: How to set iOS UITextField border color? (RubyMotion + iOS)