TofuBeer
TofuBeer

Reputation: 61526

Is it possible to have a TextView without a Keyboard?

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?

Upvotes: 1

Views: 490

Answers (4)

Arjun Sa
Arjun Sa

Reputation: 125

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;

}

Upvotes: 0

isak
isak

Reputation: 11

Try this:

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

Upvotes: 1

Becca Royal-Gordon
Becca Royal-Gordon

Reputation: 17861

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.)

Upvotes: 1

hhafez
hhafez

Reputation: 39750

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

Upvotes: 1

Related Questions