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表示,当前设备 ...
随机推荐
- C++中的struct与class继承方式
代码: #include <iostream> #include <cstdio> using namespace std; //class A{ struct A{ publ ...
- Ubuntu中安装编译并测试HTK语音识别库
1.在网上看到首先必须确保电脑上安装了g++和libx11 g++ --version //检测g++版本 sudo apt-get install libx11-dev:i386 2.然后可从HTK ...
- 近期Responsive web design项目经验分享-高分辨率图片处理篇
在高分辨率的情况下 商品的图片难免会失真 怎样才能让商品的图片在高分辨率的情况下 效果不失真 提供用户更好的体验呢 我发现了一个解决方案 不知道是不是你想要的 先上图片对比下效果 左侧是使用后 ...
- ECSTORE日期时间控件转换为时间戳的方法
如果你在后台使用<{input type=”time” name=”time”}>的话,后台获取到的表单数据为: ["_DTYPE_TIME"]=> array( ...
- PHP打开PDO_MySQL扩展的配置方法
PHP中的PDO其实是一个很好用的扩展,在一些PHPCMS系统中,开发者大多都有用到,那么如何开启PDO和PDO_MySQL扩展呢?方法同样很简单: 打开php.ini配置文件,找到extension ...
- 什么叫CallBack函数,怎么用回调函数?
JQuery众多常用方法中很经常会用到回调函数, 理解好js callback函数定义及用法,我们就可以利用callback函数帮我们做很多事情啦! A callback is a function ...
- win7系统64位"禁用驱动程序签名强制"如何设置?
换了Win7系统64位旗舰版的朋友是不是都发现了一点,以前32位Win7系统用的好好的小程序小应用,一下子就装不上了.这是由于Win7系统64位系统对于未有认证签名的驱动程序进行了限制安装,而大部分小 ...
- cf B. Dima and To-do List
http://codeforces.com/contest/366/problem/B 从0到k枚举起点,然后i+k判断是不是i+k>=n如果是i=(i+k)%n;否则i=i+k; #inclu ...
- LeetCode_Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- 如何备份及恢复Linux文件权限
你可能听说或碰到过这样的事情:一个系统管理员菜鸟不小心输入"chmod -R 777 /"从而导致了巨大的悲剧,使得整个系统遭到了严重的破坏.在日常管理中,我们有许多工具可以用来备 ...