我的 material textview 的占位符既不能通过界面生成器工作,也不能通过代码工作。
import Material
@IBOutlet weak var descriptionTextView: TextView!
我在viewdidload里试过了
descriptionTextView.placeholderNormalColor = Color.black
descriptionTextView.placeholderLabel.text = "sdsd"
如果从代码中进行 tring,控制台会出错
Failed to set (placeholder) user defined inspected property on (UITextView): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key placeholder.
最佳答案
这看起来像是最近修复的错误。请参阅: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"
希望对你有帮助。
关于ios - Material TextView 占位符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46392567/