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表示,当前设备 ...
随机推荐
- 有几数组表单,js怎么获得数组并动态相加输出到文本框
有几数组表单,js如何获得数组并动态相加输出到文本框<input name= "fee1[] "> <input name= "fee2[] & ...
- ios app开发步骤
虽然开发一个app的任务看上去可能很艰巨,但是整个过程可以抽象成几个相对简单的步骤,下面这些步骤会在你开发第一个app时帮你步入正途. 定义Concept 每个好app都是从一个concept开始. ...
- 自律训练法 John Sehorz
自律训练法,系1932年由德国精神医学医师John Sehorz所创立.他研究人们在催眠催眠状态下,所呈现的生理状态,如:沉重与温暖感.. ,因而,John Sehorz改以「逆向操作」之方式,由自我 ...
- C程序设计语言练习题1-1
练习1-1 在你自己的系统中运行"hello, world"程序.再有意去掉程序中的部分内容,看看会得到什么出错信息. 代码如下: #include <stdio.h> ...
- android获取屏幕宽高与获取控件宽高
获取屏幕宽高 // 获取屏幕宽高(方法1) int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); // 屏幕宽(像素 ...
- BZOJ2292: 【POJ Challenge 】永远挑战
2292: [POJ Challenge ]永远挑战 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 513 Solved: 201[Submit][ ...
- (2.1)servlet线程安全问题
本文参考链接:http://www.yesky.com/334/1951334.shtml 摘 要:介绍了Servlet多线程机制,通过一个实例并结合Java 的内存模型说明引起Servlet线程不安 ...
- POJ2828---线段树与逆序数&&DUTOJ1210---逆序对构造排列
来看这样一道问题:http://acm.dlut.edu.cn/problem.php?id=1210 题目大意:对于一个1-n的排列,a1,a2,a3,a4...an我们把满足i < j,ai ...
- Address Book(地址薄)
<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.Scene?> ...
- C# 使用Sqlite 如何返回统计行数
Visual 2010 with Sqlite 需要这样Query 数据: select count(*) from tblOrder where OrderStartTime >= '2013 ...