我是 notes.app 之类的应用。我将 UITextView 的 contentInset 设置为
myTextView.contentInset = UIEdgeInsetsMake(0, 25, 0, -25);
myTextView.contentSize = CGSizeMake(295, myTextView.contentSize.height);
但这似乎并没有像我预期的那样工作。隐藏了两个字符。
我明白了
但是如果我设置
myTextView.contentInset = UIEdgeInsetsMake(0, 25, 0, 0);
myTextView.contentSize = CGSizeMake(295, myTextView.contentSize.height);
我得到的实际文本是
请帮忙。
最佳答案
fibnochi 你可以使用不同的方法来做到这一点。我已经在我的一个应用程序中使用过它并且运行良好
首先你需要得到 UItextView 的大小,它会承载所有的数据,为此你需要使用 NSString 类委托(delegate)函数
NSString* str = @"Your Entire string will come here";
CGSize size = [str sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:CGSize(295, any large digit for maximum height say 10000) lineBreakMode:UILineBreakModeWordWrap];
textView.contentSize = size;
这是否能解决您的问题。请告诉我
关于iphone - UItextView 文本隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13800612/