parse.com - changing placeholder text in parse loginviewcontroller -
parse.com - changing placeholder text in parse loginviewcontroller -
so i'd alter username placeholder in parse loginview controller, text showing fuzzy - how either set right shadows/highlights ... or alter text without changing style attributes.
https://parse.com/tutorials/login-and-signup-views
both of these below create fuzzy grayness text without right shadow/highlights
loginviewcontroller.loginview.usernamefield.attributedplaceholder = [[nsattributedstring alloc] initwithstring:@"phone" attributes:@{}]; loginviewcontroller.loginview.usernamefield.placeholder = @"phone";
i don't know effect want apply (there few example/screenshot on link). here or set want (and apply value want):
nsattributedstring *originalusernameplaceholder = loginviewcontroller.loginview.usernamefield.attributedplaceholder; nsshadow *shadow = [[nsshadow alloc] init]; [shadow setshadowblurradius:2.0]; [shadow setshadowcolor:[uicolor graycolor]]; [shadow setshadowoffset:cgsizemake(0, 2.0)]; nsdictionary *attributescustom = @{nsshadowattributename: shadow, nsforegroundcolorattributename:theuicoloryouwant}; nsattributedstring *attrstring = [[nsattributedstring alloc] initwithstring:@"customtext" attributes: attributescustom]; loginviewcontroller.loginview.usernamefield.attributedplaceholder = attrstring; note customtext [originalusernameplaceholder string];
you can read more various effect wan apply here.
now, retrieve setting want mimic (because it), retrieving specific settings:
__block nsdictionary *attributesretrieved; [attrstring enumerateattributesinrange:nsmakerange(0, [attrstring length]) options:nsattributedstringenumerationlongesteffectiverangenotrequired usingblock:^(nsdictionary *attrs, nsrange range, bool *stop) { nslog(@"attrs: %@", attrs); attributesretrieved = [attrs copy]; }]; there should 1 attribute (for whole text). example, on 1 set: got:
attributesretrieved: { nscolor = "uidevicewhitecolorspace 1 1"; nsshadow = "nsshadow {0, 2} blur = 2 color = {uidevicewhitecolorspace 0.5 1}"; } can retrieve previous setting set before.
parse.com nsattributedstring
Comments
Post a Comment