Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-02-2008, 01:16 PM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Default UITextView keyboard

I have a UIView with a UITextView as a subview. I want the keyboard to appear automatically with the view and call

Code:
[textView becomeFirstResponder]
but this does not work AND for some reason, it then takes 2 presses to get the keyboard to show. If I do not make the first responder call, 1 press will make the keyboard appear.

This same technique works correctly for a UITextField.

Am I missing something obvious?
Fastrak is offline   Reply With Quote
Old 07-02-2008, 05:43 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 26
Default Re: UITextView keyboard

Where are you calling this from? I am using it with no problem in the loadView()

[textField becomeFirstResponder];
[self.view addSubview:textField];
iPhoneGuy is offline   Reply With Quote
Old 07-02-2008, 07:34 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Default Re: UITextView keyboard

Quote:
Originally Posted by iPhoneGuy
Where are you calling this from? I am using it with no problem in the loadView()

[textField becomeFirstResponder];
[self.view addSubview:textField];

TextField works fine for me as well. The problem I am having is when I try this with a UITextView.
Fastrak is offline   Reply With Quote
Old 07-04-2008, 11:59 AM   #4 (permalink)
New Member
 
Join Date: May 2008
Age: 28
Posts: 65
Default Re: UITextView keyboard

I have the same problem, it takes two or more presses to appear , did somebody found a solution? :?:
paos is offline   Reply With Quote
Old 08-13-2008, 10:54 AM   #5 (permalink)
Registered Member
 
cmezak's Avatar
 
Join Date: Jul 2008
Posts: 207
Default

I'm having this problem, too. when I add a becomeFirstResponder message before I add the textView to the viewController's view, the view loads with a cursor in the textView, but with no keyboard. No tapping will bring the keyboard up, either. Here's my code:

Code:
notesTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
notesTextView.text = [sighting notes];
notesTextView.font = [UIFont systemFontOfSize:20];
notesTextView.delegate = self;
notesTextView.backgroundColor = [UIColor lightGrayColor];
self.view.backgroundColor = [UIColor lightGrayColor];
[notesTextView setReturnKeyType:UIReturnKeyDone];
[notesTextView becomeFirstResponder];
[self.view addSubview:notesTextView];
Also, I've set the keyboard's return key type to Done, but the key still adds a newline rather than telling the textView to resign first responder. If I am supposed to handle this manually, how so?

Thanks
Charlie

Last edited by cmezak; 08-13-2008 at 10:58 AM.
cmezak is offline   Reply With Quote
Old 08-13-2008, 11:10 AM   #6 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

Submit it as a bug.
DevTeamOfOne is offline   Reply With Quote
Old 08-13-2008, 11:30 AM   #7 (permalink)
Registered Member
 
cmezak's Avatar
 
Join Date: Jul 2008
Posts: 207
Default

If this is a bug, wouldn't we have heard more noise about it? Editing a textView is a pretty common task, I should think.

I'm going to seek out some sample code that could put me on the right track.

- Charlie
cmezak is offline   Reply With Quote
Old 08-13-2008, 11:44 AM   #8 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 361
Default

adding it as a first responder, however, may have been less important.

And there are also massive bugs in the 2.0 SDK anyway...
DevTeamOfOne is offline   Reply With Quote
Old 10-03-2008, 03:58 PM   #9 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 2
Default It is a bug (even in 2.1)

The is a known bug that I filed a while ago under Bug ID# 5944064. At least now I can mention it...

Michael
mzapp is offline   Reply With Quote
Old 10-26-2008, 10:31 PM   #10 (permalink)
Lost in a sea of code
 
BostonMerlin's Avatar
 
Join Date: Apr 2008
Location: Boston
Posts: 399
Default

Anyone figure this out? I have all the same settings as those from the OP. Just want to that darn keyboard to show up with my view is displayed. UITextView is already set as firstresponder and when the view is shown my cursor is sitting in the TextView but no keyboard.

Anyone?
__________________
----------------------------------------------------------------------
I love being a dad, flying airplanes and writing code.
----------------------------------------------------------------------
Follow me on Twitter: @BostonMerlin
Feed your brain on Twitter: @iPhoneDev101
----------------------------------------------------------------------
iPhone Apps:
BostonMerlin is offline   Reply With Quote
Old 10-26-2008, 11:27 PM   #11 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 2
Default

Quote:
Originally Posted by BostonMerlin View Post
Anyone figure this out? I have all the same settings as those from the OP. Just want to that darn keyboard to show up with my view is displayed. UITextView is already set as firstresponder and when the view is shown my cursor is sitting in the TextView but no keyboard.

Anyone?
There's no work around, you simply have to wait until Apple fixes it. Hopefully that will be really soon now. You might want to look around at the iPhone developer website...
mzapp is offline   Reply With Quote
Old 10-26-2008, 11:31 PM   #12 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 53
Default

I’m not the only one! This bug has been driving me insane and I haven’t been able to figure out a workaround.
rendezvouscp is offline   Reply With Quote
Old 10-27-2008, 11:15 AM   #13 (permalink)
New Member
 
mcurtis's Avatar
 
Join Date: Oct 2008
Location: St. Louis
Posts: 44
Default

I've found that I can make this work if I place the call to -becomeFirstResponder in -viewDidAppear: instead of -loadView or -viewWillAppear:.
mcurtis is offline   Reply With Quote
Old 11-12-2008, 10:56 PM   #14 (permalink)
jdg
New Member
 
Join Date: Aug 2008
Location: Wichita, KS
Posts: 12
Send a message via AIM to jdg
Default

Hey guys,

Found a workaround. I really do not recommend doing this -- as the workaround relies on another bug, and there's no stopgap so that if that bug is fixed, the keyboard will show up by default.

Remove all becomeFirstResponder's for the UITextView, then in your viewDidAppear, set editable to NO, then set editable to YES:

Code:
UITextView *utv;
utv.editable = NO;
utv.editable = YES;
... which makes it work for me (in a modal controller).
jdg is offline   Reply With Quote
Old 11-13-2008, 07:09 AM   #15 (permalink)
Lost in a sea of code
 
BostonMerlin's Avatar
 
Join Date: Apr 2008
Location: Boston
Posts: 399
Default

Quote:
Originally Posted by jdg View Post
Hey guys,

Found a workaround. I really do not recommend doing this -- as the workaround relies on another bug, and there's no stopgap so that if that bug is fixed, the keyboard will show up by default.

Remove all becomeFirstResponder's for the UITextView, then in your viewDidAppear, set editable to NO, then set editable to YES:

Code:
UITextView *utv;
utv.editable = NO;
utv.editable = YES;
... which makes it work for me (in a modal controller).
I found that this code works on the device but not in the simulator (2.1)... which for me is just fine for now. thanks!

John
__________________
----------------------------------------------------------------------
I love being a dad, flying airplanes and writing code.
----------------------------------------------------------------------
Follow me on Twitter: @BostonMerlin
Feed your brain on Twitter: @iPhoneDev101
----------------------------------------------------------------------
iPhone Apps:
BostonMerlin is offline   Reply With Quote
Old 02-03-2009, 02:35 AM   #16 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 3
Default did u'll find the solution to this ?

[notesTextView setReturnKeyType:UIReturnKeyDone];

it still adds a new line and doesnt dismiss the keyboard.
vijayeta is offline   Reply With Quote
Old 09-30-2009, 10:43 PM   #17 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 50
Default

Has anyone notices that using becomeFirstResponder on the UITextView to make it load with the keyboard causes a leak ?

Anybody know any workaround to this?
rnieves is offline   Reply With Quote
Old 12-26-2009, 06:10 PM   #18 (permalink)
Registered Member
 
scotopia's Avatar
 
Join Date: Oct 2008
Posts: 2,028
Default

Quote:
Originally Posted by rnieves View Post
Has anyone notices that using becomeFirstResponder on the UITextView to make it load with the keyboard causes a leak ?

Anybody know any workaround to this?
I've noticed; got the same thing.
scotopia is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UITextView mutiline paos iPhone SDK Development 3 04-17-2009 06:18 PM
Activity Screen on top of keyboard? javid.alimohideen iPhone SDK Development 7 01-15-2009 04:18 AM
UITextView with word wrap? halusha iPhone SDK Development 3 07-06-2008 03:36 AM
UIWebView keyboard Fastrak iPhone SDK Development 1 06-19-2008 05:21 PM
Drop keyboard down with touch somewhere else? BuschyBoy iPhone SDK Development 2 04-21-2008 06:08 PM


» Advertisements
» Online Users: 251
23 members and 228 guests
ADY, Alsahir, beleg_1998, Dani77, diyora, FAED, fredidf, iDifferent, iph_s, JamesCahall, JasonR, mer10, prchn4christ, Rudy, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, timle8n1, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:11 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0