为什么我的 uialeartview 旋转时总是改变位置
我的 uialartview 代码。 当它以横向或纵向显示时可以,但是当 将纵向更改为横向或将横向更改为纵向,
它总是会向上移动,而不是像以前那样在窗口中心移动,
我如何在旋转时使其成为窗口中心。
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];
My uialeartview code.
when it show in Landscape or Portrait it ok but when
change Portrait to Landscape or Landscape to Portrait
it will always move up not in center of window like before
how can i make it it center of window when rotage.
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不必将
UIAlertView
添加为子视图,只需使用[over show]
并且之后不要忘记释放它。You don't have to add the
UIAlertView
as a subView, just use[over show]
and don't forget to release it afterwards.