UITextField設置placeholder顏色

方式一:spa

_codeTextField.attributedPlaceholder = [[NSAttributedString allocinitWithString:@"請輸入驗證碼(4位數字)" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:kTextLightGray]}];code

方式二:KVC方式orm

_phoneTextField.placeholder = @"請輸入手機號碼";ci

 [_phoneTextField setValue:[UIColor colorWithHex:kTextLightGrayforKeyPath:@"_placeholderLabel.textColor"];it

相關文章
相關標籤/搜索