EGOTextFieldAlertView icon indicating copy to clipboard operation
EGOTextFieldAlertView copied to clipboard

Does not work on iOS 4

Open olegam opened this issue 14 years ago • 10 comments

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

olegam avatar Jun 12 '10 12:06 olegam

Confirm

tobiasbayer avatar Jun 24 '10 20:06 tobiasbayer

As a replacement you can use http://github.com/erica/iphone-3.0-cookbook-/tree/master/C10-Alerts/03-Soliciting%20Text/

olegam avatar Jun 24 '10 21:06 olegam

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

jupiter avatar Jun 30 '10 13:06 jupiter

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.

josecastillo avatar Jul 13 '10 00:07 josecastillo

Brilliant! That fixes it. Thanks.

jupiter avatar Jul 13 '10 18:07 jupiter

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.

josecastillo avatar Jul 15 '10 19:07 josecastillo

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

gonso75 avatar Apr 25 '11 10:04 gonso75

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

jupiter avatar May 26 '11 11:05 jupiter

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

hellhound avatar Aug 16 '11 19:08 hellhound

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]])

CodeSix avatar Jan 15 '12 16:01 CodeSix