unity针对iphone的屏幕旋转
屏幕旋转可以在引擎里设置:
依次点开 Edit——Project Setting——Player 即可设置如图:
接下来的是 雨松大神的 代码控制,本屌是安卓机器,没能测试。
C#
using UnityEngine;
using System.Collections; public class Main : MonoBehaviour { //键盘输入
private iPhoneKeyboard keyboard; //字体皮肤
public GUISkin fontSkin; // Use this for initialization
void Start () {
} // Update is called once per frame
void Update () {
} void OnGUI() {
//设置皮肤
GUI.skin = fontSkin; //强制屏幕纵向
if (GUI.Button(new Rect(, , , ), "change LandscapeLeft")) {
Screen.orientation = ScreenOrientation.LandscapeLeft;
}else if (GUI.Button(new Rect(, , , ), "change LandscapeRight")) {
Screen.orientation = ScreenOrientation.LandscapeRight;
}else //强制屏幕横向
if (GUI.Button(new Rect(, , , ), "change Portrait")) {
Screen.orientation = ScreenOrientation.Portrait;
}else if (GUI.Button(new Rect(, , , ), "change PortraitUpsideDown")) {
Screen.orientation = ScreenOrientation.PortraitUpsideDown;
} if (GUI.Button(new Rect(, , , ), "open Keyboard")) {
//打开iphone输入框
//第一个参数 默认显示 test
//第二个参数 设置输入框类型,这里为默认,什么都可以输入
keyboard = iPhoneKeyboard.Open("test",iPhoneKeyboardType.Default); } if(keyboard != null){ if (keyboard.done){
//输入完毕后 点击done 输入输入内容
Debug.Log( keyboard.text) ;
}
} }
}
前辈还提供了 键盘的一些常用属性:
iPhoneKeyboardType.Default 默认键盘
iPhoneKeyboardType.NumbersAndPunctuation : 输入标点符号与数字
iPhoneKeyboardType.URL:输入网址
iPhoneKeyboardType.PhonePad:输入电话
iPhoneKeyboardType.NumberPad:输入数字
iPhoneKeyboardType.EmailAddress:输入Email
unity针对iphone的屏幕旋转的更多相关文章
- iPhone屏幕旋转
iPhone屏幕内容旋转 在iOS6之前的版本中,通常使用 shouldAutorotateToInterfaceOrientation 来单独控制某个UIViewController的方向,需要哪个 ...
- unity 设置屏幕旋转
只允许竖屏: Portrait √ Portrait Upside Down √ Landscape Right × Landscape Left ...
- 监听iOS检测屏幕旋转状态,不需开启屏幕旋转-b
-(void)rotation_icon:(float)n { UIButton *history_btn= [self.view viewWithTag:<#(NSInteger)#>] ...
- H5项目常见问题及注意事项,视频全屏,定位,屏幕旋转和触摸,偏页面重构向 来源joacycode的github
Meta基础知识: H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 //一.HTML页面结构 <meta name="viewport" content="wi ...
- 监听iOS检测屏幕旋转状态,不需开启屏幕旋转
-(void)rotation_icon:(float)n { UIButton *history_btn= [self.view viewWithTag:<#(NSInteger)#>] ...
- 【Android】[转] Android屏幕旋转使用OrientationEventListener的监听
说明 遇到一个奇葩的问题,我在使用onConfigChanged拦截屏幕的横竖屏旋转时,发现直接进行180度的横屏/竖屏转换居然没有反应!查找原因发现仅对landscape或者portrait状态有用 ...
- 【转】IOS屏幕旋转与View的transform属性之间的关系,比较底层
iTouch,iPhone,iPad设置都是支持旋转的,如果我们的程序能够根据不同的方向做出不同的布局,体验会更好. 如何设置程序支持旋转呢,通常我们会在程序的info.plist中进行设置Suppo ...
- ios6和ios7禁止屏幕旋转
ios6和ios7禁止屏幕旋转 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOr ...
- iOS屏幕旋转 浅析
一.两种orientation 了解屏幕旋转首先需要区分两种orientation 1.device orientation 设备的物理方向,由类型UIDeviceOrientation表示,当前设备 ...
随机推荐
- DX笔记之五------游戏画面绘图之绘制位图
本系列文章由zhmxy555编写,转载请注明出处. http://blog.csdn.net/zhmxy555/article/details/7335103 共四步 步骤一:加载位图 步骤二:建立与 ...
- hdu 4277 USACO ORZ (暴力+set容器判重)
USACO ORZ Time Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- CentOS 5.5安装图解教程
说明:实际生产环境中,CentOS 5.5这个版本相当稳定,而且硬件兼容性也很好,是很多服务器装机者的首选系统,下面介绍CentOS 5.5的具体安装过程 说明:实际生产环境中,CentOS 5. ...
- DEDE数据库修改后台变量
进行数据库之后找到 dede_sysconfig 这个数据表,然后查找到你要删除的dede教程变量名称. 这样就可以了
- AFC项目开发文档整理
AFC项目开发文档整理 PHPCMS 的确是一个伟大的CMS,我对它爱不释手. 标签嵌套无法loop获取的解决办法.关键代码如下: /\*后台添加\*/ $str = preg_replace ( & ...
- Kafka笔记--分布式环境搭建
部署: http://www.cnblogs.com/likehua/p/3999538.html http://blog.csdn.net/kimmking/article/details/8263 ...
- Android相关类关系
Activity Window.WindowManager View. interface----ViewManager LayoutInflater Components Activity.Serv ...
- 编译Qt 4.7.3的时候发生NMAKE : fatal error U1077: 'cd' : return code '0x2'
怀疑是configure的时候没加-nomake demos -nomake examples的问题 references: http://stackoverflow.com/questions/10 ...
- netstat命令, netstat指令在windows和linux有什么不同
查看当前tcp监听端口[op@TIM html]$ netstat -nltp(Not all processes could be identified, non-owned process inf ...
- CONTEST45 呵呵呵呵呵
题目质量差评!为什么不给数据范围! A.乘积最大3 题目:http://dev.luogu.org/problem/show?pid=2172 题解:sb题,均值定理. 代码: #include< ...