Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does storyboard eliminate the need for .nib

With the introduction of storyboard, I wouldn't select to create a .xib/.nib when I create a subclass of UIViewController, because I can just drag out a viewcontroller in interface builder and assign it to the new class.

So, with storyboard, when would i need to use the .xib/.nib file?

Thank you.

like image 668
William Sham Avatar asked Dec 13 '11 19:12

William Sham


People also ask

Should I use Storyboard or XIB?

When you want to see some flow without building the app, a storyboard is the best option. Also if you create static table views or more then one cell template, you can use a storyboard.

Is SwiftUI better than Storyboard?

Conclusion. After looking at the pros and cons of both Storyboard and SwiftUI, according to my opinion building app UI using storyboard is comparatively easier for a beginner, and has been there was a very long time, but there are some flaws with it and that flaws have been taken care of in Swift UI.

What is difference between XIB and NIB?

In fact, the acronym "NIB" comes from "NeXTSTEP Interface Builder", and "XIB" from "Xcode Interface Builder". NIBs and XIBs are effectively the same thing: XIBs are newer and are used while you're developing, whereas NIBs are what get produced when you create a build.


2 Answers

Storyboards don't completely remove the need for NIB files. One common example is when creating subviews to go inside a UIScrollView. You can't create the subviews separately in a storyboard; instead you have to create separate NIB(s) for the subviews and attach them to the scroll view programatically.

In fact, on almost any occasion where you have a need for subviews which change at runtime you'll want to use separate NIBs.

Storyboards are great for certain kinds of apps, but for anything even remotely complicated the old way works very well still. An additional benefit is that they co-exist nicely. You can put placeholder views in your storyboard and fill them programatically with NIB-defined views later on.

like image 131
Tim Avatar answered Oct 12 '22 01:10

Tim


I guess, storyboard contains the .xib/.nib files for all your views. It present relationships between them and helps you to avoid confusion if you have a LOT of views. Also it saves your time and nerves when writing code.

like image 43
Akki Avatar answered Oct 12 '22 03:10

Akki