views:

101

answers:

2

Anyone know why Jeff Lamarche's Alert View with prompt class produces a alert that is mostly off screen when used in iOS4? All the code in a downloadable project can be found here:

http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html

His sample project out of the box, in the 3.2 simulator (running as an iphone app on an ipad) appears properly centered. But in the 4.0 simulator, both in the iPhone and iPhone 4 devices, it appears very high on the screen and mostly off the screen. I have not tested it yet on other OS's or on an actual device.

By changing the line:

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 130.0); 

to:

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 0.0); 

it correctly centers in the screen in iOS4 but is then too low on the 3.2. Of course I could adjust the value based on which device or os is in use, but I'd rather know WHY it's off.

+1  A: 

I'm speculating, but the Affine translation looks like a hack in the first place . . . presumably Apple's UIAlertView translated stuff by -130 prior to IOS4.0, so LaMarche put in his translation to counteract that.

Then in 4.0, assuming [and this is speculative] that Apple fixed its class, LaMarche's code no longer works.

William Jockusch
I'm checking your answer as correct even though I'm not sure if it's right or not. I can assume that it is. But the bottom line is that I need a way to do this. My problem is that my game is openGL and I need a way to handle os type alerts and modals over top of my game's glview I have another question out there right now because using the new sms message controller in ios4 destroys my framebuffer, so any other advice on how to do this one is appeciated.
badweasel
A: 

FWIW, I just had this exchange on Twitter:

Me:

Just came across AlertPrompt by @jeff_lamarche [link removed], looks great, but is there a better option since this?

Jeff: http://twitter.com/jeff_lamarche/status/21449214776

Don’t use that AlertPrompt - uses a private API. Best bet is to design it in an offscreen UIView, then use Core Animation to show

nomad00