如何使单行 TextView 仅水平滚动 [英] How to make single line TextView scroll horizontally only

查看:30
本文介绍了如何使单行 TextView 仅水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有一行的小 TextView.当该行充满文本时,我希望此 TextView 开始水平滚动而不是垂直滚动.

I have a little TextView with a single line. When the line is full of text, I want this TextView start scrolling horizontally not vertically.

要拍一张照片,就像在 Apple 的邮件应用程序中填写收件人:"字段一样.

To make a picture of this, it's like in the Apple's mail app when you fill the "To :" field.

我尝试了不同的方法,但没有人成功:/

I've tried different way but no one worked :/

CGSize size = textView.contentSize;
size.height = CGRectGetHeight(textView.frame);
size.width = 300;
textView.contentSize = size;
textView.alwaysBounceVertical = NO;

任何帮助将不胜感激,干杯

Any help would be greatly appreciate, cheers

推荐答案

您似乎正在寻找 UITextField 其行为与您描述的完全一样.

It seems you are looking for a UITextField which behaves exactly like you described.

这篇关于如何使单行 TextView 仅水平滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆