如何设置iOS UITextField边框颜色? (RubyMotion + iOS)
如何使用RubyMotion设置textField边框颜色?
示例代码:
textField = UITextField.alloc.init textField.borderStyle = UITextBorderStyleLine
边框颜色显示为Apple默认颜色; 我希望它是红色的。
这是使用RubyMotion,而不是Objective-C
使用Quartz框架。
在你的Rakefile中:
app.frameworks << 'QuartzCore'
要设置图层属性:
textField.layer.borderColor = UIColor.redColor.CGColor textField.layer.borderWidth = 1 textField.layer.masksToBounds = true