iPhone XIB 迅速成长为巨大尺寸

发布于 2024-09-12 05:54:48 字数 1928 浏览 1 评论 0原文

我曾经有一个非常小/简单的 XIB 文件。
某些因素导致它迅速增长到超过 500k。

其中唯一的图形是 3 个小 PNG 文件(每个大约 4k)。

这是 XIB 的一些内容。你知道是什么导致了这个尺寸的增加吗?

   <string key="NSFrame">{{0, 44}, {320, 416}}</string>
                        <reference key="NSSuperview" ref="391473517"/>
                        <object class="NSColor" key="IBUIBackgroundColor">
                            <int key="NSColorSpace">10</int>
                            <object class="NSImage" key="NSImage">
                                <int key="NSImageFlags">469473884</int>
                                <string key="NSSize">{256, 256}</string>
                                <object class="NSMutableArray" key="NSReps">
                                    <bool key="EncodedWithXMLCoder">YES</bool>
                                    <object class="NSArray">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                        <integer value="0"/>
                                        <object class="NSBitmapImageRep">
                                            <object class="NSData" key="NSTIFFRepresentation">
                                                <bytes key="NS.bytes">
anB3/3Byef91d33/dHZ8/2psc/9sbnX/Z2p0/3N1fP9qbXf/cXN6/2psdf9wcnv/dnd9/25xe/9ucHf/
cnB3/2ptd/92eH//a254/3Fzev9sb3n/cHJ5/25wd/9ucHf/cHN9/25wd/9wcnn/dnh8/2xudf93eX//
bm13/2ptd/9sb3n/bG51/3V3ff97fYP/YmVu/25xe/9sb3n/c3Z//2psc/9zdXz/cHN9/2dqcf9qbHP/
CmVu/2dqdP9nanH/am13/2xvef91eIH/Z2p0/25xe/91d33/bG51/25wd/92eHz/dXd9/29xdf9ucHf/
fHl9/2xudf9ucHf/bG95/3Bzff9sb3n/bnF7/3l7gf9zdn//c3Z//3N2f/91eIH/c3V8/3Byef9nanT/
zXd9/2dqdP9ucXv/dXd9/3N2f/9zdXz/Z2px/2xudf9ucXv/am13/3Bzff9zdXz/cHN9/2psc/9qbXf/
AbG51/2Jlbv9qbXf/aGp0/2hqcP9rbnX/cnV//29yfP9ucXv/bnF7/25xe/9zdn//bXB1/2xvef9qbXb/

I used to have a very small/simple XIB file.
Something has caused it to quickly grow to over 500k.

The only graphics in it are 3 small PNG files (about 4k each).

Here's some of the XIB. Any idea on what is causing this size increase?

   <string key="NSFrame">{{0, 44}, {320, 416}}</string>
                        <reference key="NSSuperview" ref="391473517"/>
                        <object class="NSColor" key="IBUIBackgroundColor">
                            <int key="NSColorSpace">10</int>
                            <object class="NSImage" key="NSImage">
                                <int key="NSImageFlags">469473884</int>
                                <string key="NSSize">{256, 256}</string>
                                <object class="NSMutableArray" key="NSReps">
                                    <bool key="EncodedWithXMLCoder">YES</bool>
                                    <object class="NSArray">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                        <integer value="0"/>
                                        <object class="NSBitmapImageRep">
                                            <object class="NSData" key="NSTIFFRepresentation">
                                                <bytes key="NS.bytes">
anB3/3Byef91d33/dHZ8/2psc/9sbnX/Z2p0/3N1fP9qbXf/cXN6/2psdf9wcnv/dnd9/25xe/9ucHf/
cnB3/2ptd/92eH//a254/3Fzev9sb3n/cHJ5/25wd/9ucHf/cHN9/25wd/9wcnn/dnh8/2xudf93eX//
bm13/2ptd/9sb3n/bG51/3V3ff97fYP/YmVu/25xe/9sb3n/c3Z//2psc/9zdXz/cHN9/2dqcf9qbHP/
CmVu/2dqdP9nanH/am13/2xvef91eIH/Z2p0/25xe/91d33/bG51/25wd/92eHz/dXd9/29xdf9ucHf/
fHl9/2xudf9ucHf/bG95/3Bzff9sb3n/bnF7/3l7gf9zdn//c3Z//3N2f/91eIH/c3V8/3Byef9nanT/
zXd9/2dqdP9ucXv/dXd9/3N2f/9zdXz/Z2px/2xudf9ucXv/am13/3Bzff9zdXz/cHN9/2psc/9qbXf/
AbG51/2Jlbv9qbXf/aGp0/2hqcP9rbnX/cnV//29yfP9ucXv/bnF7/25xe/9zdn//bXB1/2xvef9qbXb/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰火雁神 2024-09-19 05:54:48

因此,为我解决这个问题的解决方案与 UIColor 上名为 viewFlipsideBackgroundColor 的类方法有关。在我的 xib 中,我将 UIImage 上的背景颜色设置为这种模式,我猜 xcode 然后会在 xib 中抛出 320x460 的 tiff 表示。当我改变这个颜色后,xib 大小就下降了 800kb。

您的 xib 中是否包含任何模式?如果是这样,请尝试以编程方式应用它们。

So the solution that fixed it for me had to do with the class method on UIColor called viewFlipsideBackgroundColor. In my xib I set the background color on a UIImage to be this pattern, and I guess xcode then throws a tiff representation in the xib that is 320x460. As soon as I changed this color, the xib size dropped 800kb.

Did you include any patterns in your xib? If so, try applying them programatically.

夏末 2024-09-19 05:54:48

它们可能是您拖入的 PNG 文件,但 xib 包含 TIFF 数据:



您应该从笔尖中删除图像,并将 PNG 文件包含在应用程序包中,并在代码中按名称引用它们。

(当然,这是假设您展示的 xib 小片段实际上与问题相关,而不是完全无辜的东西。)

They might have been PNG files that you dragged in, but the xib contains TIFF data:

<object class="NSData" key="NSTIFFRepresentation">

You should remove the images from your nib and include the PNG files in your application bundle and refer to them by name from your code.

(That's assuming, of course, that the small snippet of xib you showed is actually relevant to the problem, and not something completely innocent.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文