問題原因:
由于只設(shè)置了attributedPlaceholder垒手,字體和 textField 的默認(rèn)字體不一致,導(dǎo)致 UITextFieldLabel 的高度小于 UITextField 的倒信。需設(shè)置 textField.font 和 attributedPlaceholder.font 大小一致即可科贬。
textField.attributedPlaceholder = ({
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] init];
[text appendString:@"請輸入您要搜索的內(nèi)容" font:FONT(13) color:UIColorHex(c2c2c2)];
text;
});
textField.font = FONT(13);
修復(fù)前
修復(fù)前
Capture view
capture view
修復(fù)后
修復(fù)后