• 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: UIAlertView won't set password field as first responder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIAlertView won't set password field as first responder


  • Subject: Re: UIAlertView won't set password field as first responder
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 22 Apr 2015 16:03:24 -0700

> On Apr 22, 2015, at 1:34 PM, Kyle Sluder <email@hidden> wrote:
>
> Accessing the subviews of a view you do not own is by definition
> "messing with the internals".
> ...
> Just because a method exists doesn't mean that it is OK for arbitrary
> clients to access it.

Kyle, you may have forgotten that -textFieldAtIndex: is a method specifically declared in UIAlertView. It’s not some general-purpose method inherited from UIView. The documentation (see below) even helpfully tells you which field is the password field.

Removing the text field or changing its frame might constitute “messing with”, but giving it focus seems like a perfectly reasonable thing to do.

Back to the question at hand — some of the other discussion makes me suspect that -didPresentAlertView: is getting called earlier than it used to, maybe before the alert is actually fully presented. So try adding a delayed-perform so the text field’s focus will get set slightly later.

—Jens

/* Retrieve a text field at an index - raises NSRangeException when textFieldIndex is out-of-bounds.
   The field at index 0 will be the first text field (the single field or the login field), the field at index 1 will be the password field. */
- (UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0);

_______________________________________________

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: UIAlertView won't set password field as first responder
      • From: Kyle Sluder <email@hidden>
References: 
 >UIAlertView won't set password field as first responder (From: Rick Mann <email@hidden>)
 >Re: UIAlertView won't set password field as first responder (From: Kyle Sluder <email@hidden>)
 >Re: UIAlertView won't set password field as first responder (From: Rick Mann <email@hidden>)
 >Re: UIAlertView won't set password field as first responder (From: Kyle Sluder <email@hidden>)
 >Re: UIAlertView won't set password field as first responder (From: Rick Mann <email@hidden>)
 >Re: UIAlertView won't set password field as first responder (From: Kyle Sluder <email@hidden>)

  • Prev by Date: RE: Converting to Window Coordinates
  • Next by Date: UIImage to jpeg results change between 32-bit & 64-bit
  • Previous by thread: Re: UIAlertView won't set password field as first responder
  • Next by thread: Re: UIAlertView won't set password field as first responder
  • Index(es):
    • Date
    • Thread