• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [IPhone 3.0] How do I make a UITextField the first responder?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IPhone 3.0] How do I make a UITextField the first responder?


  • Subject: Re: [IPhone 3.0] How do I make a UITextField the first responder?
  • From: Andy Lee <email@hidden>
  • Date: Tue, 25 Aug 2009 09:02:58 -0400

On Aug 25, 2009, at 8:28 AM, Brian Bruinewoud wrote:
On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:

On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton. The user will most often want to type text and ignore the button. Is there some way I can make the keyboard appear immediately that view is shown? I can't find anything in IB and reading about UITextField, UIView, UIWindow, UIResponder didn't enlighten me.

-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
 [super viewDidLoad];
 [_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I noticed that its documentation said

"Use the NSWindow makeFirstResponder: method, not this method, to make an object the first responder. Never invoke this method directly."

You're reading the Cocoa docs, not the iPhone docs. There's no NSWindow on the iPhone.


The *iPhone* doc for becomeFirstResponder says:

"You may call this method to make a responder object such as a view the first responder. However, you should only call it on that view if it is part of a view hierarchy. If the view’s window property holds a UIWindow object, it has been installed in a view hierarchy; if it returns nil, the view is detached from any hierarchy."

--Andy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [IPhone 3.0] How do I make a UITextField the first responder?
      • From: Brian Bruinewoud <email@hidden>
    • Re: [IPhone 3.0] How do I make a UITextField the first responder?
      • From: Andy Lee <email@hidden>
References: 
 >[IPhone 3.0] How do I make a UITextField the first responder? (From: Brian Bruinewoud <email@hidden>)
 >Re: [IPhone 3.0] How do I make a UITextField the first responder? (From: "Georg C. Brückmann" <email@hidden>)
 >Re: [IPhone 3.0] How do I make a UITextField the first responder? (From: Brian Bruinewoud <email@hidden>)

  • Prev by Date: Re: What's the purpose of the "fax" received action?
  • Next by Date: Re: What's the purpose of the "fax" received action?
  • Previous by thread: Re: [IPhone 3.0] How do I make a UITextField the first responder?
  • Next by thread: Re: [IPhone 3.0] How do I make a UITextField the first responder?
  • Index(es):
    • Date
    • Thread