开发者

iphone app best practice - is using the IB a better way to design your app, or writing UI code on your own better?

开发者 https://www.devze.com 2023-01-10 15:03 出处:网络
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?

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?

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 )

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?


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

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).

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.

Hope that helps.


I would find it hard to believe if there was a best practice for this. It depends on the App. I have found myself moving away from nibs as for complex screens where elements are changing / appearing or disappearing using a nib doesn't make sense as its unnecessarily making the code more complex or messy.

As far as speed is concerned, after my experience it is marginally noticeable but probably not worth considering. Think of your time vs reusable code and by the sounds of things I would of chosen the same solution as you.

0

精彩评论

暂无评论...
验证码 换一张
取 消