iphone - positioning subclassed UIAlertView window with onscreen keyboard on iOS -


i'm using subclassed uialertview window login prompt in application (i know it's against apple guidelines not submitted appstore it's not problem).

the code add text fields , position window on screen looks this:

- (id)initwithtitle:(nsstring *)title delegate:(id)delegate {     if (self = [super initwithtitle:title message:@"\n\n\n" delegate:delegate cancelbuttontitle:@"cancel" otherbuttontitles:@"login", nil]) {         uitextfield *logintf = [[uitextfield alloc] initwithframe:cgrectmake(12.0, 55.0, 260.0, 25.0)];         // text field settings removed code clarity          [self addsubview:logintf];         self.logintextfield = logintf;         [logintf release];          uitextfield *passwordtf = [[uitextfield alloc] initwithframe:cgrectmake(12.0, 85.0, 260.0, 25.0)];         // text field settings removed code clarity         [self addsubview:passwordtf];         self.passwordtextfield = passwordtf;         [passwordtf release];          cgaffinetransform translate = cgaffinetransformmaketranslation(0.0, 90.0);          [self settransform:translate];     }      return self; } 

the problem settransform call:

on ios 3.x:
- without settransform: window displayed centered horizontally , vertically on screen, onscreen keyboard displayed partially on top of - whole window not visible
- settransform: window displayed 90 pixels higher, whole visible onscreen keyboard displayed.

on ios 4.x however:
- without settransform: window displayed fine (visible above onscreen keyboard)
- settransform: window displayed partially above top border of screen (90 pixels high).

what best solution issue? detecting ios version , calling settransform conditionally? or it's ugly hack , there better way?

because ios 4 has been released newer devices (and ios 4.2 ipad right around corner), recommend setting base sdk latest version of ios 4 , compiling application version. however, if want application available original iphone , ipod touch users, conditionally using settransform method best way.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -