Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on iOS 4 #2

Open
olegam opened this issue Jun 12, 2010 · 10 comments
Open

Does not work on iOS 4 #2

olegam opened this issue Jun 12, 2010 · 10 comments

Comments

@olegam
Copy link

olegam commented Jun 12, 2010

When build for iOS 4 the alert view is displayed too high and text input does not work.

@tobiasbayer
Copy link

Confirm

@olegam
Copy link
Author

olegam commented Jun 24, 2010

@jupiter
Copy link

jupiter commented Jun 30, 2010

Would be great if someone solves this issue without using a totally different implementation. I'd prefer getting it to work.

@josecastillo
Copy link

The text input issue has to do with the UITextField being a subview of the EGOAlertTextFieldBack. The fix is to add the backView as a subview of the alertView, and add the textView as a sibling positioned atop it. You'll have to do a little bit of finangling with the geometry, but it's not terribly difficult.

Re: the positioning of the alertview itself, just delete the line:
self.transform = CGAffineTransformTranslate(self.transform, 0.0f, 150.0f);
Under iOS 4, it appears the OS automatically handles repositioning of a UIAlertView when one of its text fields becomes first responder.

@jupiter
Copy link

jupiter commented Jul 13, 2010

Brilliant! That fixes it. Thanks.

@josecastillo
Copy link

Anyone who is using this class and needs an iOS 4 fix, here is my fork of the class. Fixes text input issue and the positioning weirdness.

http://github.com/josecastillo/EGOTextFieldAlertView

Caveat: to fix the latter issue, I added a bigger delay from the [alert show] to the keyboard appearing. See comments in -show if you wanna take a stab at something more clever.

@gonso75
Copy link

gonso75 commented Apr 25, 2011

josecastillo's fix was working great for iOS 4, but it stopped working on 4.3 and on iPad 4.2+.

I have no clue why, but the text boxes wont move up with the alert when the keyboard appears....

any ideas?
Gonso

@jupiter
Copy link

jupiter commented May 26, 2011

Gonso,

I found a fix for josecastillo's EGOTextFieldAlertView.

In EGOTextFieldAlertView.m, it is detecting the wrong Y offset due to a new UIImageView in the UIAlertView subviews. Therefore, replace:

if(![view isKindOfClass:[UIControl class]]) {

with:

if(![view isKindOfClass:[UIControl class]] && ![view isKindOfClass:[UIImageView class]]) {

And all works as before.

Best,
Pieter

@hellhound
Copy link

I managed to hack Tom Swift's UIAlertView re-implementation. I added iOS 3 backward compatibility and multiple UITextField API :) https://github.com/bitzeppelin/TSAlertView

@CodeSix
Copy link

CodeSix commented Jan 15, 2012

The textfield issue was fixed by changing -layoutSubviews in .m:

if (![view isKindOfClass:[UIControl class]])

to

if (![view isKindOfClass:[UIControl class]] && ![view isKindOfClass:[UIImageView class]] && ![view isKindOfClass:[EGOAlertTextFieldBack class]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants