屏幕旋转可以在引擎里设置:

依次点开 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的屏幕旋转的更多相关文章

  1. iPhone屏幕旋转

    iPhone屏幕内容旋转 在iOS6之前的版本中,通常使用 shouldAutorotateToInterfaceOrientation 来单独控制某个UIViewController的方向,需要哪个 ...

  2. unity 设置屏幕旋转

    只允许竖屏: Portrait                    √ Portrait Upside Down √ Landscape Right        × Landscape Left ...

  3. 监听iOS检测屏幕旋转状态,不需开启屏幕旋转-b

    -(void)rotation_icon:(float)n { UIButton *history_btn= [self.view viewWithTag:<#(NSInteger)#>] ...

  4. H5项目常见问题及注意事项,视频全屏,定位,屏幕旋转和触摸,偏页面重构向 来源joacycode的github

    Meta基础知识: H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 //一.HTML页面结构 <meta name="viewport" content="wi ...

  5. 监听iOS检测屏幕旋转状态,不需开启屏幕旋转

    -(void)rotation_icon:(float)n { UIButton *history_btn= [self.view viewWithTag:<#(NSInteger)#>] ...

  6. 【Android】[转] Android屏幕旋转使用OrientationEventListener的监听

    说明 遇到一个奇葩的问题,我在使用onConfigChanged拦截屏幕的横竖屏旋转时,发现直接进行180度的横屏/竖屏转换居然没有反应!查找原因发现仅对landscape或者portrait状态有用 ...

  7. 【转】IOS屏幕旋转与View的transform属性之间的关系,比较底层

    iTouch,iPhone,iPad设置都是支持旋转的,如果我们的程序能够根据不同的方向做出不同的布局,体验会更好. 如何设置程序支持旋转呢,通常我们会在程序的info.plist中进行设置Suppo ...

  8. ios6和ios7禁止屏幕旋转

    ios6和ios7禁止屏幕旋转 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOr ...

  9. iOS屏幕旋转 浅析

    一.两种orientation 了解屏幕旋转首先需要区分两种orientation 1.device orientation 设备的物理方向,由类型UIDeviceOrientation表示,当前设备 ...

随机推荐

  1. 武汉科技大学ACM :1003: 零起点学算法67——统计字母数字等个数

    Problem Description 输入一串字符,统计这串字符里的字母个数,数字个数,空格字数以及其他字符(最多不超过100个字符) Input 多组测试数据,每行一组 Output 每组输出一行 ...

  2. [Leetcode][020] Valid Parentheses (Java)

    题目在这里: https://leetcode.com/problems/valid-parentheses/ [标签]Stack; String [个人分析]这个题应该算是Stack的经典应用.先进 ...

  3. Selinux 禁用

    Selinux是对于强制访问控制的实现,在这种访问控制体系的限制下,进程只能访问那些在他的任务中所需要文件. 对于新手来说会影响我们的操作.一般情况下是不需要的,所以禁用他,如果需要的情况下,我们可以 ...

  4. jsonp跨域请求学习笔记

    前言 ajax,用苍白的话赞扬:很好. 我们可以使用ajax实现异步获取数据,减少服务器运算时间,大大地改善用户体验:我们可以使用ajax实现小系统组合大系统:我们还可以使用ajax实现前端的优化.( ...

  5. resumable.js —— 基于 HTML 5 File API 的文件上传组件 支持续传后台c#实现

    在git上提供了java.nodejs.c#后台服务方式:在这里我要用c#作为后台服务:地址请见:https://github.com/23/resumable.js 我现在visual studio ...

  6. MySQL binlog_rows_query_log_events

    当binlog_format=statement的时候进制日志只记录的是SQL语句,当binlog_fromat=row的时候记录的是event,如果想要在row模式的情况下 也记录SQL语句:bin ...

  7. Log4j MDC Tomcat下报异常org.apache.log4j.helpers.ThreadLocalMap

    严重: The web application [/qdgswx] created a ThreadLocal with key of type [org.apache.log4j.helpers.T ...

  8. cf B. Vasya and Public Transport

    http://codeforces.com/contest/355/problem/B #include <cstdio> #include <cstring> #includ ...

  9. LeetCode_Swap Nodes in Pairs

    Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2-& ...

  10. Unity脚本的生命周期中几个重要的方法

    1.function Update () {} 正常更新,用于更新逻辑.此方法每帧都会由系统自动调用一次.2.function LateUpdate () {} 推迟更新,此方法在Update() 方 ...