2011-09-27 53 views
0

我的uialeartview代碼。 當它顯示在橫向或縱向就OK了,但是當 改變縱向到橫向或橫向到縱向爲什麼我的uialeartview總是在旋轉時改變位置

它總是在窗口的中心上移而不是像以前

我怎樣才能讓IT窗口的中心當旋轉時。

UIAlertView *over; 
      over=[[UIAlertView alloc]initWithTitle:@"Game over" 
                  message:[NSString stringWithFormat:@"Your score : %d\n\n\n",score] 
                 delegate:self 
               cancelButtonTitle:@"OK" 
               otherButtonTitles:nil]; 
      [over show]; 

      UITextField *nameinputfiled=[[UITextField alloc]initWithFrame:CGRectMake(11, 80, over.frame.size.width-50, 31)]; 
      nameinputfiled.backgroundColor=[UIColor whiteColor]; 
      [over addSubview:nameinputfiled]; 
[over release]; 

回答

0

您不必到UIAlertView添加爲一個子視圖,只需使用[over show],不要忘記在事後將其釋放。

+0

現在我改變了代碼,但它也上移時旋轉 – MAXZZXAM

+0

嘗試評論添加'UITextField' - 它仍然改變位置? – tilo

+0

不,如果我評論添加textfield行的位置不會改變像我想但我需要它的文本字段。 – MAXZZXAM

相關問題