最小化和恢复我的应用程序后,UITabBar 标题被截断
我有一个带有 UITabBar 的应用程序。
我正在使用 UITabBarAppearance
来配置它。
当我启动应用程序时,选项卡项目是正确的:
但是当我最小化然后重新打开应用程序时,它们看起来像这样:
点击标签栏项目然后恢复它们回到原来的样子,即文本被正确绘制。
对于为什么会发生这种情况有什么建议吗?
仅供参考我使用的外观代码是这样的:
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.shadowImage = nil
appearance.backgroundColor = UIColor.custom.navBackground
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.custom.pink]
appearance.stackedLayoutAppearance.normal.titleTextAttributes = textAttributes
appearance.stackedLayoutAppearance.selected.titleTextAttributes = textAttributes
appearance.inlineLayoutAppearance.normal.titleTextAttributes = textAttributes
appearance.inlineLayoutAppearance.selected.titleTextAttributes = textAttributes
self.tabBar.standardAppearance = appearance
self.tabBar.scrollEdgeAppearance = appearance
I have an app with a UITabBar.
I'm using the UITabBarAppearance
to configure it.
When I start the app, the tab items are correct:
but when I minimise and then reopen the app they look like this:
Tapping on the tab bar items then restores them back to their original look i.e. the text is correctly drawn.
Any suggestions why this might be happening?
FYI The appearance code I'm using is this:
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.shadowImage = nil
appearance.backgroundColor = UIColor.custom.navBackground
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.custom.pink]
appearance.stackedLayoutAppearance.normal.titleTextAttributes = textAttributes
appearance.stackedLayoutAppearance.selected.titleTextAttributes = textAttributes
appearance.inlineLayoutAppearance.normal.titleTextAttributes = textAttributes
appearance.inlineLayoutAppearance.selected.titleTextAttributes = textAttributes
self.tabBar.standardAppearance = appearance
self.tabBar.scrollEdgeAppearance = appearance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论