Pages

Difference between Storyboard file && nib file

As you know that you can design User Interface using both storyboard file as well as nib file. You can drag && drop objects from object library provided by Xcode, connect connections to the controller from both of these files. But there is a lot of difference between storyboard an nib file.It should be understand by you. Let me tell you this difference:

A nib file is an object graph strictly speaking a frozen graph of objects. When you load nib file into your running application the objects in this frozen object graph becomes alive all at once && comes to existence with all the connections you connected them to. System creates new or fresh instance of all the objects  in this file && connects all the outlets && connections between these objects. So you can say that nib file is static until something calls it to make it alive. In this file all object is active at once even if nothing is using them at the moment. So this is the disadvantage of the nib file

But a storyboard, is somewhat more capable && advantageous then a nib file. You can consider that each scene in the storyboard is roughly equals to a nib file. In storyboard you carn connects different scenes with segues. That's why a storyboard is much more complex than a nib file. Unlike a nib file a storyboard is not loaded all at once when the project get compiled. Instead an event that causes the scene to be loaded will end up loading a frozen object graph corresponding to that event from the storyboard. One more thing to be noted from above conclusion that objects on the scene in the storyboard may or may not necessarily exists all at the same time. Moreover in storyboard you can't connect an object from one scene to the other scene.