4

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)

cannyboy
  • 24,180
  • 40
  • 146
  • 252

1 Answers1

1

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

iMeMyself
  • 1,649
  • 13
  • 28