材料TextView的placholder无法正常工作

时间:2017-09-24 16:58:16

标签: ios swift textview material cosmicmind

我的材料textview的占位符既不是从界面构建器也不是代码。

import Material

@IBOutlet weak var descriptionTextView: TextView!

我在viewdidload中试过了

descriptionTextView.placeholderNormalColor = Color.black
descriptionTextView.placeholderLabel.text = "sdsd"

如果从代码中获取错误,则在控制台中出现错误

  

无法设置(占位符)用户定义的检查属性   (UITextView):[setValue:forUndefinedKey:]:   对于关键占位符,此类不符合键值编码。

1 个答案:

答案 0 :(得分:2)

这看起来像是最近修复的错误。请参阅:https://github.com/CosmicMind/Material/commit/7d45b9431b78d0367eddcbd2eb9b4ad65b3ce458

要下载最新的pod版本,您需要在Podfile中指定:

pod 'Material', :git => 'https://github.com/CosmicMind/Material.git'

然后,您可以将代码更改为:

textView.placeholderColor = Color.black
textView.placeholder = "sdsd"

我希望它可以帮到你。