> On Apr 22, 2015, at 1:34 PM, Kyle Sluder <k...@ksluder.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to