开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜