Using text markup Language for layout, the most used should be the HTML language. HTML can be understood as an XML language with a special set of tags.
First, iOS Xib and storyboard display principle
There are 3 main ways to decorate the interface in iOS: Code, Xib,storyboard.
1. Code
The Code layout interface is versatile, but often complex. Laying out a simple interface may require a lot of line code, so it's tedious.
Here is the code to create a button, with a minimum of 3 lines:
UIButton *btn = [UIButton buttonwithtype:uibuttontypecontactadd]; Btn.center = Cgpointmake (+); [Self.view ADDSUBVIEW:BTN];
2. Xib
The xib is suitable for small-block interfaces and can also be used as a single interface. belongs to the drag control type, only need to write the code to load Xib.
To open the result of the Xib file with a text editor:
As you can see, the Xib essence is also an XML file.
The <document> tag is what xib to display.
You can see what is going to be displayed in the <view> tab. The Xib only shows a blank view with a color.
The principle of xib is to parse the XML file, find the corresponding view, convert it into code, and then create the object and display it.
Shaped like:
UIView *view = [[UIView alloc] init]; View.frame = CGRectMake (0.0, 0.0, 320, 480);
3.storyboard
Storyboard is suitable for large interface jump, and the rich Viewcontroller makes it very easy to do relief.
Similarly, opening storyboard with a text editor can be seen as follows:
It's essentially an XML file.
The <objects> tab is the interface you want to create. Here Tabbarcontroller is used as the root view controller.
Tabbarcontroller points to 4 other view controllers.
The principle of storyboard is to parse the XML file, find the appropriate controller, convert it into code, and then create the object and display it. same as the xib principle .
Second, Android and iOS layout display comparison
As we all know, the layout of Android is basically complete with XML, even if there is a so-called can drag the control of the place, can only be used to shape.
The iOS package is pretty good, and if you don't open it with a text editor, a lot of people may not know that this is an XML file to display the layout.
on the Fundamentals : The basic layout of Android and iOS is the same, both separating the view from the model data and following the MVC design pattern.
Reprint Please specify source: http://blog.csdn.net/xn4545945