为什么不使用XIB文件的好理由? [英] Good reasons why to not use XIB files?

查看:141
本文介绍了为什么不使用XIB文件的好理由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我不应该使用具有高度自定义UI和广泛动画以及超低内存占用需求的XIB / NIB文件?



作为初学者我从XIB开始。然后我发现我无法做到其中的一切。它开始变得非常难以按我希望的方式定制东西。所以最后,我扔掉了所有的XIB并以编程方式完成了所有操作。



所以当有人问我XIB是否合适时,我会说:是的,如果你想要制作糟糕乏味的界面而不太关心性能,请继续。但是还有什么原因可以不使用XIB?



我是唯一一个因为这个原因而更喜欢以编程方式完成所有工作的iPhone开发人员吗?

解决方案

我认为Interface Builder是Mac(以及扩展,iPhone)软件开发的最大资产之一。 GUI是可视的;为什么使用可视化界面创建它们? IB足够灵活,您可以使用其通用组件布局接口,然后在必要时将它们子类化。当然,如果你有一个独特的界面,你将不得不继承视图类并执行自定义绘图,但你也可以在IB中布局你的界面,然后轻松使用检查器将类切换到你的自定义子类。 / p>

Are there any good reasons why I should not use XIB / NIB files with an highly customized UI and extensive animations and super low memory footprint needs?

As a beginner I started with XIB. Then I figured out I couldn't do just about everything in them. It started to get really hard to customize things the way I wanted them to be. So at the end, I threw all my XIBs away and did it all programmatically.

So when someone asks me if XIB is good, I generally say: Yeah, if you want to make crappy boring interfaces and don't care too much about performance, go ahead. But what else could be a reason not to use XIB?

Am I the only iPhone developer who prefers doing everything programmatically for this reasons?

解决方案

I think that Interface Builder is one of the biggest assets of Mac (and by extension, iPhone) software development. GUIs are visual; why not create them using a visual interface? IB is flexible enough that you can lay out an interface using its "generic" components, and then subclass them where necessary. Sure, if you have a unique interface you're going to have to subclass a view class and perform custom drawing, but you can also lay out your interface in IB and then easily use the inspector to switch the class to your custom subclass.

这篇关于为什么不使用XIB文件的好理由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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