如何设置iOS UITextField边框颜色? (RubyMotion + iOS) [英] How to set iOS UITextField border color? (RubyMotion + iOS)
本文介绍了如何设置iOS UITextField边框颜色? (RubyMotion + iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用RubyMotion设置textField边框颜色?
示例代码:
textField = UITextField.alloc.init
textField.borderStyle = UITextBorderStyleLine
边框颜色显示为Apple默认颜色;
解决方案
这是使用RubyMotion而不是Objective- / div>
使用Quartz框架。
在您的Rakefile中:
app.frameworks<< 'QuartzCore'
要设置图层属性:
textField.layer.borderColor = UIColor.redColor.CGColor
textField.layer.borderWidth = 1
textField.layer.masksToBounds = true
How to use RubyMotion to set a textField border color?
Example code:
textField = UITextField.alloc.init
textField.borderStyle = UITextBorderStyleLine
The border color shows up as the Apple default color; I want it to be red.
This is using RubyMotion, not Objective-C
解决方案
Use the Quartz framework.
In your Rakefile:
app.frameworks << 'QuartzCore'
To set the layer attributes:
textField.layer.borderColor = UIColor.redColor.CGColor
textField.layer.borderWidth = 1
textField.layer.masksToBounds = true
这篇关于如何设置iOS UITextField边框颜色? (RubyMotion + iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文