How to set iOS UITextField border color? (RubyMotion + iOS)

别等时光非礼了梦想. 提交于 2019-12-13 01:11:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!