使用NIB文件的性能损失? [英] Performance penalty for using NIB files?

查看:132
本文介绍了使用NIB文件的性能损失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道是否有任何人有任何经验比较iPhone应用程序的加载时间性能与NIBs中的视图,视图完全以编程方式(即实例化UITextView,添加到视图,实例化UIButton,添加它到视图...)。

I am curious to know if anyone has any experience comparing the load time performance of iPhone apps with views laid out in NIBs vs. views laid out entirely programmatically (i.e. instantiating UITextView, adding it to the view, instantiating UIButton, adding it to the view…).

如果我想要一个简单的应用加载闪电,最好放弃使用NIB ,XIB技术上),而是以编程方式创建视图元素?

If I want a simple app to load lightning fast, would it be better to forgo using a NIB (well, XIB technically) and instead create view elements programmatically? Is the time spent loading and parsing a NIB sufficient enough to make a noticeable difference?

推荐答案

我注意到加载复杂的接口在具有NIB的iPhone上稍微慢。它只有一秒钟的时间,但是如果用户期望看到一张表或模态视图,它是显而易见的。我认为区别是NIBs是懒惰加载在iPhone上,所以视图实际上是第一次显示视图 - 不是当控制器和视图层次结构首次创建时创建。也就是说,它可能只对iPhone有用: - )

I've noticed that loading complex interfaces on the iPhone with NIBs is slightly slower. It's only by a fraction of a second, but it's noticeable if the user is expecting to see a sheet or modal view. I think the difference is that NIBs are lazily loaded on the iPhone, so the view is actually created the first time the view is shown - not when the controller and the view hierarchy are first created. That said, it probably only matters on the iPhone :-)

一般来说,我认为NIB总是可能存在。我写了iPhone应用程序,当SDK第一次出来和Interface Builder没有很好的测试。编写代码来创建视图层次结构是一个可怕的混乱...

In general, I'd say NIBs are always worth any performance disadvantages that might exist. I wrote iPhone apps back when the SDK first came out and Interface Builder wasn't well tested. Writing code to create view hierarchies was a terrible mess...

这篇关于使用NIB文件的性能损失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆