2015-01-09 33 views
0

當我在iPhone模擬器中觸摸我的文本字段時,鍵盤光標不會出現。我不知道爲什麼。這些是我的視圖控制器中與我的鍵盤相關的唯一功能。Xcode 6鍵盤光標不會出現在模擬器中

// hides keyboard when user touches outside of text field 
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { 
    self.view.endEditing(true) 
} 

// hides keyboard when user presses 'return' 
func textFieldShouldReturn(textField: UITextField) -> Bool { 

    if (textField === emailField) { 
     emailField.resignFirstResponder() 
    } 
    else if (textField === usernameField) { 
     usernameField.resignFirstResponder() 
    } 
    else { 
     passwordField.resignFirstResponder() 
    } 
    return true 
} 

回答

1

嘗試改變的tintColor財產的UITextField(例如,默認UIColor.blueColor)。

+0

硬件鍵盤是不活躍的。模擬器鍵盤彈出並工作正常。我可以在文本框中輸入任何內容。只是光標不可見。 – 2015-01-09 23:40:31

+0

對不起,我誤解了你的問題。在設備上運行時,光標是否可見? – 2015-01-09 23:42:33

+0

如果不是,請嘗試將'UITextField'的'tintColor'設置爲默認值('UIColor.blueColor')。 – 2015-01-09 23:44:27

0

也許iPhone模擬器中的鍵盤已關閉。

嘗試點擊,

硬件>鍵盤>切換軟件鍵盤

否則在Mac上,你可以按Commandķ