简体   繁体   English

选项卡栏图像在情节提要中显示良好,但在模拟器中却没有

[英]tab bar image displayed good in storyboard but not in simulator

I have a problem. 我有个问题。 I add some png files to my project, in my root folder. 我将一些png文件添加到我的项目的根文件夹中。 I have a tabbar controller. 我有一个标签栏控制器。 On each view, I changed the title and the picture of each items. 在每个视图上,我更改了每个项目的标题和图片。

In my storyboard, images and title are well displayed. 在我的情节提要中,图像和标题显示得很好。 But when I launched the app on the simulator, titles and images are not set... 但是当我在模拟器上启动该应用程序时,标题和图像未设置...

I tried to clean / build the solution, disconnect the simulator, reconnect it, exit XCode, launch it again. 我尝试清理/构建解决方案,断开模拟器,重新连接,退出XCode,然后再次启动。

Have you an idea why ? 你知道为什么吗?

I found the solution ! 我找到了解决方案!

If it could be useful for someone... 如果对某人有用...

In the "copy bundle Ressources", the Main.storyboard wasn't here. 在“副本捆绑包资源”中,Main.storyboard不在此处。 I just added it, rebuild, run again, and all works ! 我只是添加了它,重新构建,再次运行,并且一切正常!

I actually did not add images under Assests.xcassets. 我实际上没有在Assests.xcassets下添加图像。 After I relocated images from other location in the project to Assests.xcassets, images are displayed correctly. 将图像从项目中的其他位置重定位到Assests.xcassets之后,图像将正确显示。

我在应用程序中遇到了同样的问题,我用自定义按钮替换了默认的标签栏按钮,并通过更容易的自定义为其提供了背景图片。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM