0

我的uialeartview代码。当它以横向或纵向显示时可以,但是当将纵向更改为横向或将横向更改为纵向时

它总是会向上移动,而不是像以前那样在窗口的中心

旋转时如何使它成为窗口的中心。

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];
4

1 回答 1

0

您不必将其添加UIAlertView为子视图,只需使用[over show]并且不要忘记之后释放它。

于 2011-09-27T08:51:18.057 回答