Search code examples
iosuibarbuttonitemuiappearance

UIBarButtonItem jumps on back gesture when using custom font


I've problem with customising UIBarButtonItem title text attributes. When I use custom font (Clear Sans by Intel) it jumps on back gesture, when popping the view controller. Have you met the same problem?

Code to set attributes is:

[[UIBarButtonItem appearance] setTitleTextAttributes: @{ NSFontAttributeName: [UIFont fontWithName:@"ClearSans" size:17.0f], NSForegroundColorAttributeName: kRedColor } forState: UIControlStateNormal];

You can find the gif example here. Watch the Edit button: button jump


Solution

  • Do you have some code in viewDidAppear which might trigger that? If so, it might make sense to move it to viewWillAppear.