Demand: Product placeholder font is too large, color is too obvious, the requirements and normal input font and color is different
Method: Set the size and color of the placeholder, actually set the size and color of the placeholder label, but when the settings are finished, the placeholder font is a bit biased, so set the properties.
//set the font size for placeholder[Titlefield Setvalue:[uifont Systemfontofsize: -] Forkeypath:@"_placeholderlabel.font"]; //set the font color for placeholder[Titlefield Setvalue:[uicolor Redcolor] Forkeypath:@"_placeholderlabel.textcolor"]; //Placeholder Center DisplayNsmutableparagraphstyle *style =[Titlefield.defaulttextattributes[nsparagraphstyleattributename] mutablecopy]; Style.minimumlineheight= TitleField.font.lineHeight-(TitleField.font.lineHeight-[Uifont systemfontofsize: -].lineheight)/2; Titlefield.attributedplaceholder= [[Nsattributedstring alloc] initwithstring:@"Please enter a title here"Attributes:@{nsparagraphstyleattributename:style}];
Problem: The input text is not centered, placeholder is not centered
Method: Rewrite! Rewrite to solve all the problems!
-(CGRect) Editingrectforbounds: (CGRect) Bounds-(CGRect) Placeholderrectforbounds: (CGRect) bounds
iOS settings Uitextfield placeholder size color