正如PhoneGap版本所说的,仅上传www.zip文件夹,于是我无法理解每个平台的图标和初始屏幕文件夹的放置位置。我应该把它放在www里面吗?
提出此问题的原因是,如果我们仅将图标和启动画面保留在www内,则我的应用程序将变得非常繁重,并且由于我的应用程序是跨平台的,因此不必要的图标和启动画面文件将被添加到我的应用程序中,并且我包括所有平台的图标和飞溅。
如果我们脱机工作(PhoneGap CLI),那么我们曾经将文件保留在www文件夹之外的res文件中,而Cordova的构建过程会自动仅复制特定于平台的图标和启动画面文件,但是在这里它将添加所有文件,即使是必需的文件也是如此。适用于所选平台。
如您所知,PhoneGap Build的项目结构略有不同。是的,您只压缩并上传www文件夹,而没有其他任何东西。顺便说一句,压缩文件的名称不必是www.zip,也可以是其他名称,但它只能包含www文件夹,或者更好的是仅包含www文件夹的内容,而不包含文件夹本身。
www根文件夹中需要有icon.png和splash.png,它们是默认的图标和启动屏幕。然后,为其他图像添加一个子文件夹。您可以将其命名为res或您想要的任何名称,并在其中包含任意数量的文件夹,但是在其根目录中添加一个名称为“ .pgbomit”的空文件,这将告诉PhoneGap Build仅包括该文件夹中的所需文件,就像您提到的那样。然后,您在config.xml中使用完整路径引用每个文件,该路径也必须在www根文件夹中。
因此,结构应类似于:
www res 图标 android ios splash android ios config.xml icon.png splash.png index.html
与图标和启动屏幕相关的config.xml部分应如下所示(在版本5及更高版本中):
<icon src="icon.png" />
<splash src="splash.png" />
<platform name="ios">
<icon src="res/icon/ios/icon.png" width="57" height="57" />
<icon src="res/icon/ios/[email protected]" width="114" height="114" />
<icon src="res/icon/ios/icon-72.png" width="72" height="72" />
<icon src="res/icon/ios/[email protected]" width="144" height="144" />
<icon src="res/icon/ios/icon-60.png" width="60" height="60" />
<icon src="res/icon/ios/[email protected]" width="120" height="120" />
<icon src="res/icon/ios/[email protected]" width="180" height="180" />
<icon src="res/icon/ios/icon-76.png" width="76" height="76" />
<icon src="res/icon/ios/[email protected]" width="152" height="152" />
<splash src="res/splash/ios/Default~iphone.png" width="320" height="480"/>
<splash src="res/splash/ios/Default@2x~iphone.png" width="640" height="960"/>
<splash src="res/splash/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="res/splash/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
<splash src="res/splash/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="res/splash/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
<splash src="res/splash/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
<splash src="res/splash/ios/Default-667h.png" width="750" height="1334"/>
<splash src="res/splash/ios/Default-736h.png" width="1242" height="2208"/>
<splash src="res/splash/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
</platform>
上面的配置适用于iOS,因此请为您希望支持的其他平台添加类似的部分,但是像上面的iOS部分一样,请确保您遵循其他平台的正确图像大小和名称。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句