Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIBarButtonItem changes font after being pressed, specified in appearance proxy

I set up UIBarButtonItem title font through appearance proxy in AppDelegate:

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                      [UIFont fontWithName:@"Segoe Print" size: 14.0], UITextAttributeFont,
                                                      DEF_TITLE_COLOR,UITextAttributeTextColor,
                                                      [UIColor colorWithRed:100/255 green:128/255 blue:43/255 alpha:0.4], UITextAttributeTextShadowColor,
                                                      [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, nil]
                                            forState:UIControlStateNormal&UIControlStateHighlighted&UIControlStateDisabled];

And after that I am calling presentViewController:: in some place of my app. Bar button is shown with proper font and background image, which I set up in this ViewController (not through appearance):

enter image description here

But when I press "Join" button, standard non-customized UIAlertView is shown, and right after it appears on the screen my barButton font changes to ... standard? And color also looks like tint color. I have no Idea what I am doing wrong, tried loads of things to figure it out:

enter image description here

This bug appears only on iOS7.

like image 338
kokoko Avatar asked Sep 21 '13 17:09

kokoko


1 Answers

Well, I've figured that apperance proxy doesn't work as I expected. I copy-pasted customization method right before a place where UIBarButtonItem is initialized, and it worked as charm.

like image 167
kokoko Avatar answered Sep 20 '22 11:09

kokoko