[ios]如何创建一个全屏iphone应用

转自:http://heidianfeng.blog.163.com/blog/static/618434562010112123226240/

如何创建一个全屏iPhone应用

在这个简短的教程中,我要告诉你如何建立一个全屏iPhone应用程序。 这篇文章可能是大家谁想要建立一个为iPhone平台的游戏很有用。 您将需要苹果开发工具和iPhone SDK的计算机上安装在你要完成本教程。

有两种方法;

在您的应用Info.plist中添加一个布尔关键UIStatusBarHidden并将其设置为true。

在运行时可以调用setStatusBarHidden您的应用程序来显示/隐藏状态栏。 例如:

 [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO] 

You may also want to make your rect = [[UIScreen mainScreen] applicationFrame]




以1:接口生成器

[此方法不好用,容易留黑[除非操作view大小为全屏 这样相对复杂 还是使用 方法2好,直接修改一个plist 参数完事。]]

应用程序模板创建一个新的项目, 基于视图的。

Create a new View-Based Application

双击FullScreenViewController.xib打开界面生成器。

Double-Click FullScreenViewController.xib to launch Interface Builder

转到属性检查器面板(快捷键:Cmd的+ 1),并设置状态栏无 。

Set Status Bar to None

检查器面板的大小 (快捷键:Cmd的+ 3)和调整大小320 × 480像素的视图。

Resize the View to 320 by 480 pixels

保存文件,关闭界面生成器并返回到您的XCode项目。 单击生成并前往运行在iPhone模拟器中的应用。 你会看到状态栏依然存在。

Build the Application and see the Status Bar in iPhone Simulator

以2:编辑Info.plist文件

双击的XCode Info.plist文件编辑该文件。 添加一个额外的键/值对,并将其关键UIStatusBarHidden。

[poolo:ios 6中应该为Status bar is initially hidden]

Add the UIStatusBarHidden key to the Property List

更改为布尔值类型的UIStatusBarHidden。 现在apear一个复选框将在值列。

Change the Value type of UIStatusBarHidden to Boolean

点击复选框进行全屏魔法。

Click the checkbox to hide the Status Bar

再次构建应用程序的状态栏看到,现在在iPhone模拟器隐藏。

The Status Bar is now hidden in iPhone Simulator

猜你喜欢

转载自poolo.iteye.com/blog/1699627
今日推荐