UITextView contentInset在iOS 7上的UITextView中不起作用? [英] UITextView contentInset not working in UITextView on iOS 7?
问题描述
我正在尝试设置 UITextView
的 contentInset
属性。这样做时, UIEdgeInset
的顶部
变量就可以了。所以 [self.textView setContentInset:'UIEdgeInsetsMake(50,0,0,0)];
有效。
I'm trying to set a UITextView
's contentInset
property. When doing so, the UIEdgeInset
's top
variable works just fine. So [self.textView setContentInset: 'UIEdgeInsetsMake(50, 0, 0, 0)];
works.
但是分配UIEdgeInsets的任何其他变量都不起作用。只有顶部
会调整。 bottom
不调整,左
或右
。
But assigning any other variable of UIEdgeInsets doesn't work. Only the top
adjusts. bottom
doesn't adjust, neither do left
or right
.
所以 [self.textView setContentInset:UIEdgeInsetsMake(0,50,100,50)];
doesn'对我的textView做任何事情。
So [self.textView setContentInset: UIEdgeInsetsMake(0, 50, 100, 50)];
doesn't do anything to my textView.
我错过了什么吗?任何想法?
Am I missing something? Any ideas?
推荐答案
在iOS 7上使用setTextContainerInset而不是contentInset。
Use setTextContainerInset instead of contentInset on iOS 7.
[self.textView setTextContainerInset:UIEdgeInsetsMake(0, 50, 100, 50)];
这篇关于UITextView contentInset在iOS 7上的UITextView中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!