cocs2D-iPhone2.0 屏幕方向
来源:互联网 发布:linux临时修改ip 编辑:程序博客网 时间:2024/05/08 13:58
cocos2D默认的为横屏,但是要咋改?在网上找了一个多小时,很多都是只言片语的,不详细,一头雾水!后来终于找到了答案原来要改屏幕方向,不仅要改改代码就行!!!!!我趣~~~~~ “cocs2D-iPhone2.0 屏幕方向 ”要注意代码、ios版本、xcod的设定三点:
首先,xcode的设置
如果需要代码生效,请将 项目(左边蓝色图标那货)-》TARGETS-》Summary-》support interface orientations 中所有的屏幕方向点击设定无效,否则代码会失效。很重要的是这里ios6实测,就算这样设定后,在一些情况下屏幕方向设定还是有BUG。
代码、版本
2.0修改横竖屏在AppDelegate.m文件中有如下代码
<AppDelegate.m>iOS 6+设置使用
1 // Only valid for iOS 6+. NOT VALID for iOS 4 / 5. 2 -(NSUInteger)supportedInterfaceOrientations { 3 4 // iPhone only 5 if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ) 6 return UIInterfaceOrientationMaskPortrait; //竖屏设置 7 //return UIInterfaceOrientationMaskLandscape; //横屏设置 8 9 // iPad only10 return UIInterfaceOrientationMaskPortrait; //竖屏设置11 //return UIInterfaceOrientationMaskLandscape; //横屏设置12 }
<AppDelegate.m>iOS 4/5设置使用
1 // Only valid on iOS 4 / 5. NOT VALID for iOS 6. 2 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 3 { 4 // iPhone only 5 if( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ) 6 return UIInterfaceOrientationIsPortrait(interfaceOrientation); //竖屏设置 7 //return UIInterfaceOrientationIsLandscape(interfaceOrientation); //横屏设置 8 9 // iPad only10 // iPhone only11 //return UIInterfaceOrientationIsLandscape(interfaceOrientation); //横屏设置12 return UIInterfaceOrientationIsPortrait(interfaceOrientation); //竖屏设置13 }
- cocs2D-iPhone2.0 屏幕方向
- 网易云阅读【iPhone2.0】 交互设计回顾
- cocs2d初步
- 设置iphone屏幕方向
- 动态更改屏幕方向
- 获取屏幕方向
- 设置屏幕方向
- 动态改变屏幕方向
- WP7屏幕方向笔记
- 改变屏幕方向
- Activity之屏幕方向
- 屏幕方向设置
- android:screenOrientation屏幕方向
- 屏幕方向android:screenOrientation
- 设置屏幕的方向
- camera屏幕方向
- 屏幕方向改变实例
- 设置屏幕方向
- 精通git中文版(连载十五)
- 精通git中文版(连载十六)
- 2 Using the Bloom Effect
- 精通git中文版(连载十七)
- raw字符串
- cocs2D-iPhone2.0 屏幕方向
- 精通git中文版(连载十八)
- "undefined reference to" 问题解决方法
- 精通git中文版(连载十九)
- Openbravo如何实现一个视图
- poj 2407 Relatives
- POJ2975 & ZOJ3067 Nim [基础Nim博弈]输出方法
- C++怎样重载下标运算符 [ ]
- C#学习(三) 添加记录