The xib and storyboard principles in iOS are similar to those in Android

Source: Internet
Author: User

Text Markup Language is used for layout. The most commonly used HTML language is used. HTML can be understood as a set of XML languages with special tags.


I. How xib and storyboard are displayed in iOS

In iOS, there are three main interface layout Methods: code, xib, and storyboard.

1. Code

The Code layout interface is omnipotent, but usually complicated. Setting up a simple interface may require a lot of lines of code, so it is very cumbersome.

The following code creates a button. At least three lines are required:

UIButton *btn = [UIButton buttonWithType:UIButtonTypeContactAdd];    btn.center = CGPointMake(100, 100);    [self.view addSubview:btn];

2. xib

Xib is suitable for layout of small-sized interfaces and can also be used as a single interface. It is a drag-and-control type. You only need to write the code for loading xib.

To open the xib file in a text editor:

Vc/screens + PC9wPgo8cD7Qzsjno7o8L3A + labels = "brush: java;"> UIView * view = [[UIView alloc] init]; view. frame = CGRectMake (0.0, 0.0, 320,480 );

3. storyboard

Storyboard is suitable for large page jumps, and the rich viewController makes it easy to reduce and reduce.

Similarly, open the storyboard in a text editor. You can see the following:

Comparison of layout display between Android and iOS

As we all know, the layout in Android is basically completed in xml. Even if there is a so-called place where the controls can be dragged, it can only be roughly constructed.

IOS encapsulation is excellent. If you do not need to open it in a text editor, many may not know that this layout is displayed using an xml file.

Basic Principles: The basic layout and display principles of Android and iOS are the same. Views and model data are separated and all follow the MVC design pattern.



Reprinted please indicate the source: http://blog.csdn.net/xn4545945

Related Article

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.