是否可以有一个没有键盘的 TextView?

发布于 2024-07-14 20:36:10 字数 270 浏览 3 评论 0原文

对于我正在开发的特定应用程序,内置键盘对我来说毫无用处(我需要支持 0-9 和 X、del,仅此而已)。 我还想要一个带有大按钮的用户界面,以便更容易敲击按键。

设计一个带有按钮的 UI 很容易,但我不知道如何制作,以便当用户选择 TextView 时根本不显示键盘(我希望他们永远不会在全部)。

我确实希望 TextView 功能能够选择光标所在的位置,否则我会平底船并使用标签。

这是错误的方式吗?我应该采取其他方式吗? 如果没有的话有没有办法隐藏键盘?

For the particular application I am developing the built in keyboards are useless for me (I need to support 0-9 and X, del and nothing else). I also am after a UI with large buttons to make it easier to hit the keys.

It is easy enough to come up with a UI with the buttons, but I cannot figure how to make it so that the keyboard doesn't show up at all when the user select the TextView (I'd like them to never see it at all).

I do want the TextView feature of being able to select where the cursor is, otherwise I would punt and use a label.

Is this the wrong way all together and I should do it some other way? If not is there a way to hide the keyboard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

成熟的代价 2024-07-21 20:36:10

使 TextVeiw 不可编辑并且键盘不会出现

Make the TextVeiw uneditable and the keyboard won't come up

剪不断理还乱 2024-07-21 20:36:10

不,没有。 没有键盘的文本视图称为“标签”。 (这对插入点没有帮助,但它们是中断点。)

No, there isn't. A textview without a keyboard is called a "label". (And that won't help you with the insertion point, but them's the breaks.)

北风几吹夏 2024-07-21 20:36:10

尝试这个:

UIView* emptyView = [ [ UIView alloc ] initWithFrame:CGRectZero ];
textView.inputView = emptyView; // this will show emptyView (=nothing) instead of keyboard
[ emptyView release ];

Try this:

UIView* emptyView = [ [ UIView alloc ] initWithFrame:CGRectZero ];
textView.inputView = emptyView; // this will show emptyView (=nothing) instead of keyboard
[ emptyView release ];
蔚蓝源自深海 2024-07-21 20:36:10

是的,我们可以做到。 通过禁用用户交互来完成。
在您的 xib 中,用户交互已启用,例如
在此处输入图像描述

您必须禁用用户交互,例如
在此处输入图像描述

如果您以编程方式创建,则必须在 viewDidLoad 方法中编写以下代码,例如,

- (void)viewDidLoad
{
    [super viewDidLoad];
    UITextView *txtvew = [[UITextView alloc] initWithFrame:CGRectMake(50, 150, 150, 300)];
    txtvew.userInteractionEnabled = NO;

}

Yes We can Do that. Done by disable the User Interaction.
In your xib userinteraction is enabled like
enter image description here

you have to disable the user interaction like
enter image description here

If you created programmatically means, you have to write below code in viewDidLoad method like,

- (void)viewDidLoad
{
    [super viewDidLoad];
    UITextView *txtvew = [[UITextView alloc] initWithFrame:CGRectMake(50, 150, 150, 300)];
    txtvew.userInteractionEnabled = NO;

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文