iPhoneKeyboard.Open 打开

static function Open (text : string, keyboardType : iPhoneKeyboardType = iPhoneKeyboardType.Default, autocorrection : bool = true, multiline : bool = false, secure : bool = false, alert : bool = false, textPlaceholder : string = "") : iPhoneKeyboard

Description描述

Opens the native iPhone keyboard on the screen.

在屏幕上打开iPhone本机键盘。

The autocorrection determines whether the input tracks unknown words and suggests a more suitable replacement candidate to the user, replacing the typed text automatically unless the user explicitly overrides the action. The multiline determines if user can input more than one line of text. The secure identifies whether the keyboard is used for password. Text in the input field will be hidden from the user except the recently typed character. The keyboard can be opened in the alert mode too. The placeholder string will be displayed when there is no other text in the input field of the keyboard.

autocorrection决定是否输入追踪未知的单词并且提供一个更加适合的代替候选单词给用户,取代输入文字是自动的除非用户明确重写这个行动。multiline决定用户是否输入更多不止一行文字。secure决定键盘是否用作输入密码。文本输入字段会被隐藏打印除最近的字符。键盘也可以被打开alert模式。当没有其他文字在键盘输入区域的时候,占位符字符串将被显示。

var inputURL : String = "http://www.unity3d.com";
private var keyboard : iPhoneKeyboard;
// Opens native keyboard optimized for URL entry
//打开优化的本机键盘,用于URL进入
function OnGUI() {
	if (GUI.Button(Rect(0, 10, 200, 32), inputURL))
		keyboard = iPhoneKeyboard.Open(inputURL, iPhoneKeyboardType.URL);

	if (keyboard)
		inputURL = keyboard.text;
}
最后修改:2011年4月8日 Friday 17:03

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。