iPhoneKeyboard.Open Manual     Reference     Scripting  
Scripting > Runtime Classes > iPhoneKeyboard
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.

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.

var inputURL : String = "http://www.unity3d.com";
private var keyboard : iPhoneKeyboard;
// Opens native keyboard optimized for URL entry
function OnGUI() {
if (GUI.Button(Rect(0, 10, 200, 32), inputURL))
keyboard = iPhoneKeyboard.Open(inputURL, iPhoneKeyboardType.URL);

if (keyboard)
inputURL = keyboard.text;
}