This is in the Uitextfield class/** Runtime: Runtime can access some of the hidden properties*/+ (void) initialize{[self getivars]; [Self getProperties];}//Get all Properties+ (void) getproperties{unsignedintCount =0; objc_property_t*properties = Class_copypropertylist ([Uitextfieldclass], &count); for(inti =0; I < count; i++) {objc_property_t property=Properties[i]; NSLog (@"%s <---->%s", Property_getname, Property_getattributes (property)); }}//get list of all member variables+ (void) getivars{unsignedintCount =0; //copy out all of the member variable lists this is an array that can access the hidden propertiesIvar *ivars = Class_copyivarlist ([Uitextfieldclass], &count); for(inti =0; I < count; i + +) {//Ivar Ivar = * (Ivars + i);Ivar Ivar = ivars[i];//equivalent to the last sentence of codeNSLog (@"%s", Ivar_getname (Ivar)); } //free memory because with copyFree (ivars);}//when the view is loaded- (void) awakefromnib{//UILabel *placeholderlabel = [self valueforkey:@ "_placeholderlabel"];//Placeholderlabel.textcolor = [Uicolor redcolor];//assigning values via KVC//[self setvalue:[uicolor orangecolor] forkeypath:@ "_placeholderlabel.textcolor"];//set the cursor color to match the text colorSelf.tintcolor=Self.textcolor; [Self resignfirstresponder];}//text box becomes the first responder and is discarded when you set the color of a placeholder for a text box-(BOOL) becomefirstresponder{[self setvalue:[uicolor redcolor] Forkeypath:@"_placeholderlabel.textcolor"]; return[Super Becomefirstresponder];}-(BOOL) resignfirstresponder{[self setvalue:[uicolor whitecolor] Forkeypath:@"_placeholderlabel.textcolor"]; return[Super Resignfirstresponder];}//the outside world can assign values by accessing this property- (void) Setplaceholdercolor: (Uicolor *) placeholdercolor{_placeholdercolor=Placeholdercolor; [Self setvalue:placeholdercolor forkeypath:@"_placeholderlabel.textcolor"];}
Set the color and cursor color of Uitextfield placeholders