问题
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
回答1:
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
来源:https://stackoverflow.com/questions/25236117/how-to-set-ios-uitextfield-border-color-rubymotion-ios