title: positioning subclassed UIAlertView window with onscreen keyboard on iOS
body: <p>I'm using subclassed UIAlertView window as a login prompt in my application (I know it's against Apple guidelines but it will not be submitted to the appstore so it's not a problem).</p>
  
  <p>The code to add text fields and position the window on screen looks like this:</p>
  
  <pre><code>- (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 for 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 for code clarity
          [self addSubview:passwordTF];
          self.passwordTextField = passwordTF;
          [passwordTF release];
  
          CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 90.0); 
          [self setTransform:translate];
      }
  
      return self;
  }
  </code></pre>
  
  <p>The problem is with <code>setTransform</code> call:</p>
  
  <p>on iOS 3.x:<br>
   - without <code>setTransform</code>: The window is displayed centered horizontally and vertically on the screen, with onscreen keyboard displayed partially on top of it - so the whole window is not visible<br>
   - with <code>setTransform</code>: The window is displayed 90 pixels higher, so it is whole visible with onscreen keyboard displayed. </p>
  
  <p>on iOS 4.x however:<br>
   - without <code>setTransform</code>: The window is displayed perfectly fine (visible above the onscreen keyboard)<br>
   - with <code>setTransform</code>: The window is displayed partially above the top border of the screen (90 pixels too high).</p>
  
  <p>What would be the best solution for this issue? Detecting iOS version and calling <code>setTransform</code> conditionally? Or it's too ugly hack and there is some better way?</p>