Just My Life & My Work

[iOS] UIKeyboardType 鍵盤類型

最近事業開始做大,事情逐漸多了起來,只好在半夜趕工,將今天所看到的資訊給整理起來,以便日後參考!

一直覺得寫程式視覺化比較有趣,所以也開始推崇圖文教學,尤其是在直接跟使用者互動的智慧手機和平板電腦更是重要!

今日先來貼UIKeyboardType鍵盤類型的截圖,要是有這麼淺顯易懂的教學,就不用每個類型都執行一遍了呀~

UIKeyboardType鍵盤類型enum列舉如下:

typedef enum {
   UIKeyboardTypeDefault,
   UIKeyboardTypeASCIICapable,
   UIKeyboardTypeNumbersAndPunctuation,
   UIKeyboardTypeURL,
   UIKeyboardTypeNumberPad,
   UIKeyboardTypePhonePad,
   UIKeyboardTypeNamePhonePad,
   UIKeyboardTypeEmailAddress,
   UIKeyboardTypeDecimalPad,
   UIKeyboardTypeTwitter,
   UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable
} UIKeyboardType;

什麼是enum?

是一種用來宣告列舉型別 (Enumeration Type) 的關鍵字,是一組列舉清單項目的具名常數所構成的特殊型別,emun 主要目的在提高程式的可讀性,及易維護性。

簡單來說就是流水號,但為了更容易閱讀,而改成單字較好辨識,不需要在意其背後的數字,數字是要給程式運算用。

UIKeyboardTypeNamePhonePad

UIKeyboardTypeEmailAddress

UIKeyboardTypeDefault

UIKeyboardTypeASCIICapable

UIKeyboardTypeNumbersAndPunctuation

UIKeyboardTypeURL

UIKeyboardTypeNumberPad

UIKeyboardTypePhonePad

參考:Screenshots for UIKeyboardType、iOS Developer Library – UITextInputTraits Protocol Reference

隨意留個言吧:)~

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

標籤雲