0


once again I have a problem with my custom navigation- and toolbar: I've customised their tintColor and the font by using the appearance proxy in didFinishLaunchingWithOptions. Initially the bars should be hidden by setting their center outside the visible area in viewDidLoad. By single-tapping I use my own animation to slide the bars in/out.
Everything was working just fine until the next step:
I wanted the UIBarButtonItems to have the same font like i used in the bars, so I went back to didFinishLaunchingWithOptions and added the following code:

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:FONT_HEADER size:0.0],UITextAttributeFont,nil] forState:UIControlStateNormal];

It works just fine for the font part, but somehow it also sets the bars back into the visible position before viewWillAppear so the bars are not initially hidden anymore. I tried to find out what causes this unmeant repositioning and couldn't find any connection. I also tried to reset the position at some later point like viewWillAppear but this somehow doesn't work for the toolbar.

EDIT: The described behaviour does only occur on devices with iOS 5 though. On the iOS6 simulator everything still seems fine.

Does anyone have a hint for me what is going wrong here or how I could smoothly solve this problem? Thanks in advance

codingPanda
  • 255
  • 4
  • 13

1 Answers1

0
   [[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:FONT_HEADER size:0.0],UITextAttributeFont,nil] forState:UIControlStateNormal];

what's the FONT_HEADER here? Did you check if the ios 5 support this font?

zedzhao
  • 517
  • 1
  • 3
  • 17
  • FONT_HEADER is just a defined macro with the font name. In the meantime I tried out some things and it turned out, that using size:0.0 caused the trouble for me. Setting it to a font size != 0.0 did the trick. – codingPanda Jul 04 '13 at 10:39