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

iOS 码拜 9年前 (2015-05-09) 426次浏览 0个评论
 

我要开发一个只有横向视图的程序..也就是说.无论手机旋转成什么样都是横向视图…
现在有问题,就是启动程序的时候,显示出来的是纵向,而且格式错乱得厉害.不知道怎么显示横向视图.
我想请教一下,怎么实现这个需求.我只需要横向显示我的应用.
或者告诉我调用哪个方法或者设置可以让程序一启动就是横向视图..

40分
http://www.cocoachina.com/bbs/read.php?tid-36522-keyword-%BA%E1%C6%C1.html

有问题先搜cocoachina好些

呵呵,谢谢你。我也从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 

引用 1 楼 ww2000e 的回复:

http://www.cocoachina.com/bbs/read.php?tid-36522-keyword-%BA%E1%C6%C1.html

有问题先搜cocoachina好些


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明我要开发一个只有横向视图的程序但显示出来的是纵向
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!