Limiting UITextView to one line
Is there a way to limit UITextView to one line, whereby I can fill it with any amount of text and it will resize horizontally to match: like so:
-----------
| cheese |
-----------
... when filled with longer text becomes
--------------------------
| the last man on earth |
--------------------------开发者_开发知识库
(the lines indicate the edges of the UITextView)
this can be achieved by inheriting UITextView class as
@interface InputTextView : UITextView
@end
@implementation InputTextView
/*************************************************
* fixes the issue with single lined uitextview
*************************************************/
- (UIEdgeInsets) contentInset { return UIEdgeInsetsZero; }
@end
for further reference go-through here
精彩评论