2

I have a UIView, holding a UIButton, set as my navigationItem.titleView. When I update the text for this button, it briefly blinks (disappearing and reappearing with the new text.)

Is there anyway to keep it visible when it's changed? So, if I change 2015-2016 it appears as if only the last digit is updated to 6?

Thanks

Adama
  • 1,101
  • 8
  • 26
  • Could you share what you have tried so far? As far as I know, setting any value on a `UIView` will cause the `layoutSubviews` method to be called on that view. That will refresh the `UIView` and you normally don't have any control on how that behaves. – unspokenblabber Feb 11 '15 at 16:35
  • The button that I use in the titleView is set as a property of the current viewController, so I just [_buttonNavTitle setTitle:@"2016" forState:UIControlStateNormal]; and that's when it blinks. Doesn't seem like there's really any way around it... not a big deal, but would be a nice to have. – Adama Feb 11 '15 at 18:14
  • Thanks for your help, I solved my problem and posted the answer if you care to know. – Adama Feb 11 '15 at 18:46
  • I don't have a button in the custom view, and the titleView still blinks. – Display Name Jun 11 '18 at 13:35

1 Answers1

2

I solved my problem. This has more to do with UIButton than anything in the navigationBar's titleView.

If a UIButton is set as [yourButton buttonWithType:UIButtonTypeCustom], then it will not blink when it has been updated with [yourButton setTitle:@"title" forState:UIControlStateNormal];

Adama
  • 1,101
  • 8
  • 26
  • 1
    THANK YOU so much. This problem has been plaguing me for many months, and is very unsightly. Changing my button to UIButtonTypeCustom fixed the problem straight away! – Womble Jul 13 '16 at 03:16
  • As I don't have a button, I can't use this solution. – Display Name Jun 11 '18 at 13:35