iPhone应用程序的最佳实践 - 使用IB更好的方式来设计您的应用程序,或者更好地编写自己的UI代码? [英] iphone app best practice - is using the IB a better way to design your app, or writing UI code on your own better?

查看:102
本文介绍了iPhone应用程序的最佳实践 - 使用IB更好的方式来设计您的应用程序,或者更好地编写自己的UI代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个iphone应用程序并想知道使用IB创建和修改的NIB文件是一种更好的做法,还是可以在不使用单个NIB文件的情况下编写完整的UI代码?

I am creating an iphone app and wanted to know if using NIB files created and modified using the IB is a better practice or is it ok to write the complete UI code without using a single NIB file?

我之所以这么说是因为某些观点的数据是动态的。这取决于从我的服务器通过XML获取的数据在我的主视图上我可能需要显示一个或两个或三个或四个按钮。(最多四个按钮)

The reason I ask this is because the data for some of the views is going to be dynamic. that is on my main view depending on the data fetched from my server through XML I might need to show one or two or three or four buttons.( a max of four buttons )

所以目前我用代码编写了这个,而不是使用一个NIB文件,对于动态数据这个正确的设计可能会改变显示的按钮数量吗?

So currently i have written this using code and not using even a single NIB file, is this correct design for dynamic data that might change the number of buttons displayed?

推荐答案

我发现NIB文件限制了你很多。

What I've found is that NIB files restrict you a hell of a lot.

很高兴看到一切都在哪里out,但在一天结束时,如果你能学会以编程方式创建你的布局,那么我建议你这样做。它在你的iphone应用程序中有很多帮助,并且可以让你获得更多控制。

Its good to see where everything is laid out, but at the end of the day if you CAN learn to programatically create your layout then I would suggest doing that. It helps with so much in your iphone application, and gives you much more control.

我不知道是否有最好的练习,但我肯定会建议你做一切都是以编程方式进行的(除非你不希望对你的视图进行那么多的控制)。

I don't know if there is a best practice, but I would definitely recommend doing everything programatically (unless you don't want that much control over your view).

这就是说,如果我有一个简单的视图,我会用NIB文件来做。可能像闪屏一样。然而,我刚刚开发了一个带有模态标签栏控制器和导航控制器的应用程序,以及不同的动态视图和不同层的构建,这些都非常复杂,如果不是不可能的话,在界面构建器中执行它会非常困难。

That said, if I have a simple view I will do it with NIB files. Something like a splash screen maybe. However I've just been working on an app with a modal tab bar controller and a navigation controller and different dynamic views and the buildup of different layers and such is so complicated that doing it in interface builder would be far too difficult if not impossible.

希望有所帮助。

这篇关于iPhone应用程序的最佳实践 - 使用IB更好的方式来设计您的应用程序,或者更好地编写自己的UI代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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