UITextField
游標顏色,高度/寬度
//全部游標
[[UITextField appearance] setTintColor:[UIColor blackColor]];
//單個游標
_textField.tintColor = [UIColor redColor];
//寬高
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
CGRect originalRect = [super caretRectForPosition:position];
originalRect.size.height = self.font.lineHeight + 2;
originalRect.size.width = 5;
return originalRect;
}
自動輸入
[_textField becomeFirstResponser];
禁用/關閉 貼上選擇全選
//部分關閉
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))//禁止貼上
return NO;
if (action == @selector(select:))// 禁止選擇
return NO;
if (action == @selector(selectAll:))// 禁止全選
return NO;
return [super canPerformAction:action withSender:sender];
}
//全部關閉
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
UIMenuController *menuController = [UIMenuController sharedMenuController];
if (menuController) {
[UIMenuController sharedMenuController].menuVisible = NO;
}
return NO;
}
初始設定
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_textField.font = fontBoldCondensed11;
_textField.textColor = colorBlack000000;
_textField.tintColor = colorClear;
_textField.keyboardType = UIKeyboardTypeDecimalPad;
_textField.autocorrectionType = UITextAutocorrectionTypeNo;//自動改成正
_textField.spellCheckingType = UITextSpellCheckingTypeNo;//自動朗讀
_textField.autocapitalizationType = UITextAutocapitalizationTypeNone;//首字母大寫
_textField.placeholder = _L(@"MEMO_TAP_TO_INPUT");
_textField.rightView = self.phoneIndicatorView;
_textField.rightViewMode = UITextFieldViewModeNever;
[_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
相關文章
- iOS-UITextFieldiOSUI
- UITextField或UITextView過濾拼音UITextView
- UITextField設定正文縮排UI
- UITextField 游標位置,placeholder樣式UI
- 搜尋框或者UITextField使用ReactiveCocoaUIReact
- UITextField使用的一些細節UI
- 限制UITextField字數的正確姿勢UI
- 偷樑換柱 - iOS實現UITextField+LimitiOSUIMIT
- iOS UITextField實時監測編輯的文字iOSUI
- Swift_監聽UITextField內容的變化SwiftUI
- UITextField只允許輸入中,英文,數字UI
- 獲取UITableViewCell中UITextField的值方法總結UIView
- 微信發紅包UITextField金額輸入格式化UI
- 適當的方式模仿UITextField佔位符的顏色UI
- 如何修復UITextField在iOS10文字下沉問題UIiOS
- iOS開發若何更好的限制UITextField的輸入長度?iOSUI
- iOS -UITextField/UITextView之鍵盤遮擋輸入框解決方法iOSUITextView
- IOS 怎麼設定UIButton UITextField 不可點選且變灰iOSUI
- 一句話設定UITextField、UITextview的字數限制和placeholderUITextView
- UITextView UITextField限制輸入字數以及精準剩餘字數顯示UITextView
- 關於UITextField切換系統鍵盤和InputView的卡頓的問題UIView
- 給iOS開發新手送點福利,簡述UITextField的屬性和用法iOSUI
- IOS 學習筆記(6) 控制元件 文字域(UITextField)的使用方法iOS筆記控制元件UI
- UITextField切換secureTextEntry狀態時字型發生改變的解決辦法UI