UITextView contentInset在iOS 7上的UITextView中不起作用? [英] UITextView contentInset not working in UITextView on iOS 7?

查看:133
本文介绍了UITextView contentInset在iOS 7上的UITextView中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆