ios - navigationItem.titleView blinks when updated

2019-07-20 09:31发布

问题:

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

回答1:

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];