Friday, 15 May 2015

ios - Custom TextField with Secure Type On -



ios - Custom TextField with Secure Type On -

i have created custom textfield alter placeholder colour & move text offset little up.

here code is.

-(void)drawplaceholderinrect:(cgrect)rect{ uicolor *color = [uicolor whitecolor]; self.font = [uifont fontwithname:@"gotham-medium" size:16]; uifont *font = self.font; nsdictionary *attrsdictionary = [nsdictionary dictionarywithobjectsandkeys: font, nsfontattributename, [nsnumber numberwithfloat:1.0], nsbaselineoffsetattributename,color,nsforegroundcolorattributename, nil]; [[self placeholder] drawinrect:rect withattributes:attrsdictionary]; } - (cgrect)textrectforbounds:(cgrect)bounds { homecoming cgrectinset( bounds , 1 , 5 ); } // text position - (cgrect)editingrectforbounds:(cgrect)bounds { homecoming cgrectinset( bounds , 1 , 5 ); } - (cgrect)placeholderrectforbounds:(cgrect)bounds{ homecoming cgrectinset( bounds , 1 , 5 ); }

because of custom texfield, when typing on password filed rounded dots appears little & on homecoming action become normal.

while typing

after typing

from ios 7 on words apple provided functionality can't thing , it's not issue. default functionality secured textfield.

ios uitextfield

No comments:

Post a Comment