问题描述
我有一个 UIView
,持有一个 UIButton
,设置为我的 navigationItem.titleView
.当我更新此按钮的文本时,它会短暂闪烁(随着新文本消失并重新出现.)
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.)
有没有办法让它在更改时保持可见?那么,如果我更改 2015-2016,它看起来好像只有最后一位数字更新为 6?
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?
谢谢
推荐答案
我解决了我的问题.与 navigationBar
的 titleView
中的任何内容相比,这与 UIButton 的关系更大.
I solved my problem. This has more to do with UIButton than anything in the navigationBar
's titleView
.
如果一个 UIButton
被设置为 [yourButton buttonWithType:UIButtonTypeCustom]
,那么当它被更新为 [yourButton setTitle:@" 时它不会闪烁title" forState:UIControlStateNormal];
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];
这篇关于ios - navigationItem.titleView 在更新时闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!