我要开发一个只有横向视图的程序但显示出来的是纵向

achill7456 2010-11-02 09:09:51
我要开发一个只有横向视图的程序..也就是说.无论手机旋转成什么样都是横向视图...
现在有问题,就是启动程序的时候,显示出来的是纵向,而且格式错乱得厉害.不知道怎么显示横向视图.
我想请教一下,怎么实现这个需求.我只需要横向显示我的应用.
或者告诉我调用哪个方法或者设置可以让程序一启动就是横向视图..
...全文
108 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ww2000e 2010-11-02
  • 打赏
  • 举报
回复
http://www.cocoachina.com/bbs/read.php?tid-36522-keyword-%BA%E1%C6%C1.html

有问题先搜cocoachina好些
achill7456 2010-11-02
  • 打赏
  • 举报
回复
呵呵,谢谢你。我也从cocoachina找到答案了。
PS:csdn的管理员们听到你这么说会很伤心滴~

我也把答案贴出来吧。
每个viewcontroller里面都用这个

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.

return UIInterfaceOrientationIsLandscape(interfaceOrientation);

}

更详细更系统的描述,看这里。
http://developer.apple.com/library/ios/#documentation/General/Conceptual/iPadProgrammingGuide/CoreApplication/CoreApplication.html

下面是复制楼上的答案。
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
or

UIInterfaceOrientationLandscapeRight


[Quote=引用 1 楼 ww2000e 的回复:]
http://www.cocoachina.com/bbs/read.php?tid-36522-keyword-%BA%E1%C6%C1.html

有问题先搜cocoachina好些
[/Quote]

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧