有没有一种方法可以将 UITextView 限制为一行,这样我就可以用任意数量的文本填充它,并且它会水平调整大小以匹配:像这样:
-----------
| cheese |
-----------
...当填充较长的文本时变为
--------------------------
| the last man on earth |
--------------------------
(线条表示 UITextView 的边缘)
最佳答案
这可以通过继承 UITextView 类来实现
@interface InputTextView : UITextView
@end
@implementation InputTextView
/*************************************************
* fixes the issue with single lined uitextview
*************************************************/
- (UIEdgeInsets) contentInset { return UIEdgeInsetsZero; }
@end
进一步引用通过here
关于iphone - 将 UITextView 限制为一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6931644/