• 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: who is currently the first responder? (iOS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: who is currently the first responder? (iOS)


  • Subject: Re: who is currently the first responder? (iOS)
  • From: Roland King <email@hidden>
  • Date: Thu, 30 Jun 2011 00:04:31 +0800

On 29-Jun-2011, at 11:56 PM, Matt Neuburg wrote:

> On Wed, 29 Jun 2011 21:12:50 +0800, Roland King <email@hidden> said:
>> Is there a way to find out what UIResponder is the current first responder, the one with the keyboard up?
>
> No. I devote some space to ranting about this in my book. The app obviously *knows* who the first responder is, so why won't it tell you?

Yeah annoying isn't it - I'll file a bug report about that. Googling found a guy who's app was rejected because he found a method which returned it, could do with that being public.

>
> My workaround is to implement delegate methods on all my UITextFields and store a reference to the text field in an instance variable when it starts being edited. Oh, and as I warn in the book, do NOT name that instance variable "firstResponder" or your app will fall to its knees; guess how I found *that* out? :)
>
>> I want to make the edit commit
>
> Oh. Well, if that's your only problem, then all you have to do is call endEditing: on the superview.

aagh - thanks - I'd been looking at methods on the view controller for it, like setEditing: etc., didn't find endEditing on the view itself, that should do the trick. The documentation for that says it goes through the view hierarchy finding the text field which is the first responder, so it does what you would naively do, and in this case, they're all text fields so that's ok.

let me go put that in and try it out

thanks

>
> m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> Programming iOS 4!
> http://www.apeth.net/matt/default.html#iosbook

_______________________________________________

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: who is currently the first responder? (iOS)
      • From: Matt Neuburg <email@hidden>
References: 
 >Re: who is currently the first responder? (iOS) (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: who is currently the first responder? (iOS)
  • Next by Date: Re: How to assign a method for touch event to a UIImageView?
  • Previous by thread: Re: who is currently the first responder? (iOS)
  • Next by thread: Re: who is currently the first responder? (iOS)
  • Index(es):
    • Date
    • Thread