Add “padding” to a UITextView

前端 未结 8 527
渐次进展
渐次进展 2021-01-31 14:19

as the title says i am trying to add padding-like behavior to a UITextView. The textview is generated when the view is pushed inside my navigation controller and the following c

8条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 14:50

    This answer is totally wrong. Correct answer is simply:

    uitextview.textContainerInset =
           UIEdgeInsetsMake(8,5,8,5); // top, left, bottom, right
    

    (Those values generally match how a UITextField on the same screen looks.)


    Use this one:

    self.textView.contentInset = UIEdgeInsetsMake(5, 5, 5, 5); 
    

提交回复
热议问题