Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andyiapan

macrumors newbie
Original poster
Feb 28, 2010
29
0
TextView KeyBoard Problem
i design some buttons for inputting on textview,

but when i press on textview, a default QWERTY keyboard loaded><

i try to disabled it, but i can't modify textview content anymore.

how can i modify textview content and not display QWERTY keyboard.

Thanks~
 
What kind of keyboard do you want to use? You can change the type of keyboard for a specific UITextField or UITextView in it's properties inspector in Interface Builder.
 
What kind of keyboard do you want to use? You can change the type of keyboard for a specific UITextField or UITextView in it's properties inspector in Interface Builder.

i don't want any keyboard when i touch on textview but i can still modify textview content by my UIbutton~~
 
Solution

Code:
txtView.userInteractionEnabled = YES;
txtView.editable = YES;
use UITextViewDelegate method:
Code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
	return fromButton;
}
define the button click method:
Code:
- (void)buttonClicked{
fromButton = YES;
[txtView becomeFirstResponder];
// u'r code
fromButton = NO;
}
GoodLuck!
 
Last edited by a moderator:
Code:
txtView.userInteractionEnabled = YES;
txtView.editable = YES;
use UITextViewDelegate method:
Code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
	return fromButton;
}
define the button click method:
Code:
- (void)buttonClicked{
fromButton = YES;
[txtView becomeFirstResponder];
// u'r code
fromButton = NO;
}
GoodLuck!


how can i disable it><
Code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
	return fromButton;
}
 
Last edited by a moderator:
fromButton is an ivar which is set to NO at the beginning.

an naive question~

do i need to call
Code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
return fromButton;
}
this function in button click??
 
Last edited by a moderator:
UITextViewDelegate

This line:
Code:
[textView becomeFirstResponder];
calls the delegate method:
Code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
}
4 more information read UITextViewDelegate
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.