self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
self.window.rootViewController = [[UIViewController alloc] init];
[_window release];
//UITextField
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
textField.backgroundColor = [UIColor orangeColor];
[self.window addSubview:textField];
[textField release];
/********* 文本控制 *******/
//占位字符串? placehoder
textField.placeholder = @"哈哈哈哈哈哈哼哈";
/******** 輸入控制 ********/
// 是否可用 enabled? 默認為YES
textField.enabled = YES;
//安全文本輸入? secureTextEntry
textField.secureTextEntry = YES;
//鍵盤樣式 keyboardType
//設(shè)置鍵盤樣式善炫,比如銀行取款密碼只需要數(shù)字,有的輸入郵箱需要@等等
//UIKeyboardTypeAlphabet和UIKeyboardTypeDefault類似库继,就是我們平時看到那樣箩艺,都是字母窜醉,然后有個按鍵可以切換符號
//UIKeyboardTypeASCIICapable好像和上面差不多
//UIKeyboardTypeDecimalPad,UIKeyboardTypeNumberPad都是數(shù)字,但前者多了一個“小數(shù)點”按鍵
//UIKeyboardTypeEmailAddress-除了字母還有小數(shù)點和@出現(xiàn)
//UIKeyboardTypeNamePhonePad-貌似正常
//UIKeyboardTypePhonePad-電話鍵盤艺谆,不僅有數(shù)字還有*和#的那種
//UIKeyboardTypeNumbersAndPunctuation-只有數(shù)字和標點符號
//UIKeyboardTypeTwitter-除了字母還有@和#榨惰,這是微博的符號
//UIKeyboardTypeURL-除字母,還有.com按鈕静汤,方便輸入
//UIKeyboardTypeWebSearch-主要區(qū)別在于return鍵變成了GO鍵
textField.keyboardType = UIKeyboardTypeDefault;
//return(回車按鍵)樣式
textField.returnKeyType = UIReturnKeyGoogle;
//開始輸入時清空
textField.text = @"輸入的內(nèi)容";
textField.clearsOnBeginEditing = YES;
// 自定義鍵盤
UIView *textView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
textView.backgroundColor = [UIColor greenColor];
//給輸入框指定輸入視圖為新建的view
//? ? textField.inputView = textView;
//自定義輸入輔助視圖
textField.inputAccessoryView = textView;
/******** 外觀控制 ********/
//輸入框樣式
textField.borderStyle = UITextBorderStyleNone;
textField.layer.borderWidth = 1;
//邊框顏色
textField.layer.borderColor = [UIColor blueColor].CGColor;
//切圓角(圓形 : 正方形邊長的一半)
textField.layer.cornerRadius = 10;
//清楚按鈕
textField.clearButtonMode = UITextFieldViewModeAlways;
return YES;
}