- 文字顏色
// 1.富文本屬性:
NSMutableDictionary *attrsDic = [NSMutableDictionary dictionary] ;
attrsDic[NSForegroundColorAttributeName] = [UIColor lightGrayColor] ;
self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:attrsDic] ;
// 2.KVC:
//如何拿到這個字符串placeholderLabel?!
1.runtime遍歷屬性 ;
2.創(chuàng)建一個UITextField的對象,并在該位置打斷點(diǎn) , 然后在調(diào)試區(qū)搜索label關(guān)鍵字就可以找到想要的placeholderLabel:
UILabel *placeholderLabel = [self valueForKeyPath:@"placeholderLabel"] ;
placeholderLabel.textColor = [UIColor yellowColor] ;
placeholderLabel.png
- 光標(biāo)顏色:
//tintColor可以修改光標(biāo)顏色:凡事都得試試~tintColor感覺能修改很多不可思議控件的內(nèi)部邊邊角角的顏色~~~
self.tintColor = [UIColor blackColor] ;