【问题标题】:How to set iOS UITextField border color? (RubyMotion + iOS)如何设置 iOS UITextField 边框颜色? (RubyMotion + iOS)
【发布时间】:2014-08-11 05:01:52
【问题描述】:

如何使用 RubyMotion 设置 textField 边框颜色?

示例代码:

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

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

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

【问题讨论】:

    标签: ios cocoa-touch rubymotion


    【解决方案1】:

    使用 Quartz 框架。

    在您的 Rakefile 中:

    app.frameworks << 'QuartzCore'
    

    设置图层属性:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-24
      • 1970-01-01
      • 2014-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多