您的位置:首页 > 移动开发

iOS开发(iPad/iPhone)设置app界面 默认横向显示的两种方法

2013-04-15 13:36 966 查看
方法一:

用文本编辑工具 打开工程属性文件,也就是那个 xx-info.plist文件,把下面蓝色的部分复制进去,保存。重新编译下,OK。

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>UIInterfaceOrientation</key>

<string>UIInterfaceOrientationLandscapeRight</string>

<key>UISupportedInterfaceOrientations</key>

<array>

<string>UIInterfaceOrientationLandscapeRight</string>

<string>UIInterfaceOrientationLandscapeLeft</string>

</array>

</dict>

</plist>

方法二:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

// Return YES for supported orientations

//return (interfaceOrientation == UIInterfaceOrientationPortrait);

//只支持横屏

if(UIInterfaceOrientationIsLandscape(interfaceOrientation))

{

return YES;

}

/*else//只支持竖屏

if(UIInterfaceOrientationIsPortrait(interfaceOrientation))

{

return YES;

}

*/

return NO;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: