I want a quick input from a user. I know I can put a UITextField in UIAlertView but it\'s sort of a \"hack\". Is there an official/alternative way to do this?
It\'s
If you're willing to require iOS 5 then it's no longer a hack. UIAlertView now has a alertViewStyle
property which, when set to UIAlertViewStylePlainTextInput
, adds a single text field to the alert that you can retrieve with -[UIAlertView textFieldAtIndex:]
.
If you still require 4.3 or earlier, then no, there's no official way to do this and it really is a big "hack" that's on par with calling SPI.
I had the exact same problem and have fixed it and seems to work in both iOS 4.3 and 5.0. It seems there are some other classes further down throwing off the computing of the offsetY value. Instead of updating offsetY for all non-UIControl classes I changed it to only update it for UILabel classes.
Here is my fix in EGOTextFieldAlertView.m in layoutSubviews
change this line: if(![view isKindOfClass:[UIControl class]]) {
to: if([view isKindOfClass:[UILabel class]]) {
If your looking for an alternative way then you can create custom UIView thats looks like alert view and add as subview and make animation like alert view.
Check out EGOTextFieldAlertView.