UITextView contentInset not working in UITextView on iOS 7?

↘锁芯ラ 提交于 2020-01-24 03:57:01

问题


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.

But assigning any other variable of UIEdgeInsets doesn't work. Only the top adjusts. bottom doesn't adjust, neither do left or right.

So [self.textView setContentInset: UIEdgeInsetsMake(0, 50, 100, 50)]; doesn't do anything to my textView.

Am I missing something? Any ideas?


回答1:


Use setTextContainerInset instead of contentInset on iOS 7.

[self.textView  setTextContainerInset:UIEdgeInsetsMake(0, 50, 100, 50)];


来源:https://stackoverflow.com/questions/19203486/uitextview-contentinset-not-working-in-uitextview-on-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!