views:

21

answers:

0

I've got a problem understanding why a subclass of UIAlertView seems to be drawn in different ways in iOS3 and iOS4. My project must work under iOS4 (base sdk) and iOS3.1.3(deployment target). In that project I subclass a UIAlertView for creating an InputAlertView that is similar to the one that ask you pwd when you buy on the AppStore app. Is pretty simple to create it, just need to add a textField as a subview in the initWith..blablabla method and make it first responder in the overridden show method. If I run it, I can figure out two differences between the two iOSes: 1.In iOS3 the alertview is in the center of the view and covered a little by the keyboard. That is what I was expecting. 2.In iOS4 the alertview seems to be moved smoothly as the keyboard appears.It seems that all methods that normally you must write for bringing the textField visible are managed automatically.

Unfortunately trying to change the frame does not seem to change nothing at all, instead using a CGAffineTransformTranslate makes possible to move the alert.

I have found another difference. For making space for the UITextField in the message arguments I use the string @"\n", that string is perfect in size if I show the alert in iOS3 but is wrong and ugly in iOS4, the correct is double @"\n\n". Could it be a different system font size between iOS3 and iOS4? I've fixed everything helping myself using some boolean and overriding the -layoutSubviews method in the UIAlertView subclass, but I'm not feeling confident using these workaround.

Is it a bug or the expected behavior?

Thank you, Andrea