UITabBarItem 在第一次禁用加载时不会变暗
我可以轻松启用和禁用我的应用程序中没有值或内容的 TabBarItems
。就像魅力一样。我确实想保留所有选项卡,以便表明此功能或内容将在整个应用程序的其他视图上可用,因为此特殊视图动态填充内容超过 30 次。
TabBarController
是我的“DetailViewController
”中的子类。在此类中,我确实检查是否存在任何内容,并通过传递 viewWillAppear 事件来延迟加载内容(防止加载不存在的选项卡内容并检查互联网连接等)。工作又快又好。
问题更多的是设计光学问题。第一次加载视图可以启用和禁用,但图片不会“变暗”。加载第二个视图并执行相同的过程会“变暗”禁用的选项卡...我错过了什么?
I can easily enable and disable the TabBarItems
in my App which have no values or content. Works like a charm. I do want to keep all Tabs in order to show that this feature or content will be available on other views throughout the App because this special view is dynamically filled with content over 30times.
The TabBarController
is subclassed in my "DetailViewController
". Within this class I do check if any content exists and lazy-load the contents by passing on the viewWillAppear
event (preventing loading non existing tab contents and checking for internet connections etc.). Works fast and good.
The problem is much more an design optical one. Loading the views the first time enabling and disabling works, but the pictures are not "dimmed". Loading the second view and going through the same procedure does "dim" the disabled tabs...what am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在对
self
调用 viewWillAppear 之前我会三思而后行,因为结果可能是不可预测的。...例外是您从同名方法中调用 [super viewWillAppear]。
一般来说,最好将 Apple 回调的触发留给 Apple 处理。尝试重构 viewWillAppear 中的功能,然后在 viewDidLoad、viewWillAppear 和 viewDidAppear 中调用所需的功能。当您分解每一个功能时,问题很可能会出现。
I'd think twice before calling viewWillAppear on
self
as the results can be unpredictable....the exception being your call to [super viewWillAppear] from within the same-named method.
In general, it's best to leave the firing of Apple's callbacks to Apple. Try refactoring out the functionality you've got in viewWillAppear and then call just what you need in viewDidLoad, viewWillAppear, and viewDidAppear. The problem is likely to emerge as you break out each bit of functionality.