【问题标题】:Place UITextView placeholder/text at top-left corner将 UITextView 占位符/文本放在左上角
【发布时间】:2017-02-12 09:23:51
【问题描述】:

UITextView 中的文本位于中间,如下所示:

但我想放在左上角,而不是悬停在中间的某个地方。不知道为什么会这样。

尝试使用

textView.layer.sublayerTransform = CATransform3DMakeTranslation(x, y, z)

但它并没有改变任何东西

编辑:由于顶部的导航栏,实际边距出现。我想这就像当有 64 像素边距时 tableview 出现的问题一样。如何去除边距?

【问题讨论】:

标签: ios swift uitextview placeholder


【解决方案1】:

使用:

youtextView.contentInset = UIEdgeInsetsMake(-7.0,0.0,0,0.0); 

如果您在使用 iOS7 或更高版本时遇到问题,请尝试使用...

[yourTextView setContentOffset: CGPointMake(x,y) animated:BOOL];

【讨论】:

    【解决方案2】:

    已修复:在 viewWillLayoutSubviews 而不是 viewDidLoad 中设置 textview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-03
      • 1970-01-01
      • 2011-07-17
      • 2015-02-23
      • 2016-06-21
      • 2010-11-22
      相关资源
      最近更新 更多