iOS nib, xib and storyboard differences and storyboard loading process

Source: Internet
Author: User

First about the next nib, NIB is the product of the previous version 3.0, under the terminal we can see that the nib is actually a folder, there are executable binary files;

Distinguish between Xib and storyboard?

Different points:

1>, either nib or xib, will eventually be translated into an executable nib file until the Uiviewcontroller life cycle function Loadview is executed.

2> Storyboard is a description file for multiple Xib file collections, and a xib file corresponds to a view controller and multiple views.

When Toryboard, a project requires only one master storyboard file to be able.

Same point:

1> is an XML-based profile that enables visual programming.

//------------------------------------------------------------------------------------------------------------- --------------------------------------------------//

Main.storyboard file. So, how is storybord loaded?

AppDelegate.h is one of several default files that are automatically generated when you create storyboard apps. The schematic is as follows:

Import <UIKit/UIKit.h>

@interface Appdelegate:uiresponder <UIApplicationDelegate>

@property (Strong, nonatomic) UIWindow *window;


@end

Often say good, a hero three help. Just looking at appdelegate.h/m is not enough,  Storybord still has three heroes.






You will see that the key value of Uimainstoryboardfile or "main storyboard file base name" is set to main.

When the app starts, Uiapplicaiton automatically loads the Main.storyboard file. At the same time, the Main.storyboard is loaded automatically
Maybe you've noticed that when the app starts, it does the work, but we haven't written a single line of code yet. The biggest implication of the introduction of storyboard technology is that it greatly reduces the amount of code associated with the UI.
Storyboard helper: Settings for Deployment Info.  as follows:




Storyboard Helper: main.m file, the code is as follows:
#import <UIKit/UIKit.h> #import "AppDelegate.h" int main (int argc, char *argv[]) {    @autoreleasepool {        Return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Appdelegate class]);    }}

In MAIN.M, although the statement is not many, but this statement directly determines the life cycle of the app. The purpose of this line of code is to pass the app delegate class to Uiapplicationmain.



Only the nib needs to write more code by hand. Understand these principles, even if you create a project based on XCODE5, you can also put main.storyboard in disregard,



The difference between the nib, Xib, and storyboard of iOS and the loading process for storyboard

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.