UI--Storyboard advantages and disadvantages analysis

Source: Internet
Author: User
Tags comments
storyboard--looks beautiful Storyboard are sometimes called storyboarding, and they are often mixed. If your English is good enough, you may be able to appreciate the nuances of the two. Before we talk about storyboard, let's take a look at the background of Interface builder. Interface Builder is referred to as IB, is the Xcode development environment of the user graphical interface design tool, through which you can drag control or objects (object) to the view. These controls are stored in a XIB (pronounced Zib) or nib file. XIB is easy to understand, plainly, XIB file is an XML-formatted file, you can open rewrite this XIB file through the editing tool. When the program compiles, these view controls are compiled into a nib file. Let's start with a basic understanding of nib. Usually, nib is associated with Viewcontroller, and many viewcontroller have corresponding nib files. The role of the nib file is to describe the user interface and initialize the interface element objects. In fact, the interface and initialization objects that developers describe in NIB can be implemented in code. The reason why we use interface Builder to draw a page is to reduce the repetitive and tedious code that sets the properties of the interface so that developers can focus on the implementation of the feature. Before Xcode 4.2, each time a view is created, a corresponding xib file will be generated. When an application has more than one view, the jump management between views becomes very complex. To solve this problem, Apple launched the Storyboard is timely and practical. Take a look at Apple's comments about storyboard: "Discover how Xcode ' s Interface Builder support to storyboarding in IOS 5 makes designing your IO S apps so much easier. Storyboarding allows you to graphically arrange all your views within a single design canvas, where can then define th E app ' s logical flow, and even assign transition animations. " NIB files cannot be described from one viewcontroller to another viewcontrOller jump, this jump can only rely on handwritten code to achieve. Believe that many people will often use-presentmodalviewcontroller:animated: and-pushviewcontroller:animated: These two methods. The appearance of storyboarding makes this way history and replaces it with Segue [Segwei]. Segue defines a jump from one viewcontroller to another viewcontroller. In the IB, we are already familiar with how to connect to meet element objects and methods (Action method). In Stroyboard, we can connect the Viewcontroller by segue and no longer need handwritten code. If you want to customize segue, you also need to write the segue implementation, without writing the calling code, Storyboard will automatically invoke it. In order to use the storyboard mechanism, the MVC principle must be strictly adhered to. View and Controller need to be fully decoupled, and the different Controller should be fully decoupled. When developing an iOS application, you create a view with two implementations, one in interface Builder, the other in the UIView control, and the other by the native code method. There are pros and cons to each of the two methods. The IB approach may seem simple, but it is inconvenient to manipulate while jumping between view, and the native code (this pure handwriting code) is a huge amount of work. Even if you only create a few labels, you have to write hundreds of lines of code, each label has to set the coordinates. To solve the above problems Apple recently released iOS5 new Storyboard features. What Storyboard is. In simple terms, storyboard is the Xcode 4.2 self-contained tool, mainly used for iOS5 above version. The view that was created by the early Interfacebuilder is independent of each other, and there is no correlation, and when an application has multiple view, the jump between the view is very complex. For this reason, Apple has brought the gospel-storyboard to developers. Especially with the navigation bar and the application of the tab bar, Storyboard greatly simplifies the switch between the various views, and thus simplifies the management of the View controller development process, we can specify the view of the switching order, rather than hand-written code. Storyboard can contain all the Viewcontroller of a programAnd the connection between them. In application development, UI flow can be used as input to storyboard, and a seemingly complete UI is readily available in storyboard.

DEC 15TH, introduction

Storyboard is a new feature of the Builder storyboarding introduced by Apple in the WWDC session 309 introducing Interface Interface Builder in 2011. The basic idea is to upgrade the original xib, introduce a container to manage multiple xib files, and the container can be dragged to set the interface between Xib to jump. And this container is what Apple calls the storyboard. The picture below is a screenshot of a storyboard.

Advantages

In general, storyboard has the following benefits: You can easily storyboard the invocation relationships between all view controller interfaces. This is more friendly to the development colleagues who are new to the project team. Use storyboard to use the static cell feature of the table View controller. It is more convenient to develop a list class that is not much of a cell, but each cell is different. By implementing-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender method, the jump logic for each view controller is clustered in one place, This facilitates our unified management interface to jump and pass data. Storyboard can be used to modularize and reuse a number of common functions. For example, WWDC2011 's video of storyboard introduced the microblogging sharing module into a separate storyboard. When I develop the app, I will also make a separate storyboard for example through a third party registration module, which is easy to reuse later. Disadvantage

When I used storyboard in my new project, I found that it just looked beautiful, really used, but there were a lot of problems, and I found the problem: first it's like Xib, it's a disaster for versioning. Because it's actually a collection of multiple xib, it's easier for multiple editors to have conflicts. Apple's design for storyboard is also bad, basically you just open, do nothing, this file will be changed, so the conflict is almost inevitable-unless you do not open, you really accidentally open the look, you need to be back to the server version before submission. The Static cell characteristics provided by storyboard are only suitable for uitableviewcontroller subclasses. Many times I use a tableview nested in another uiview, the static cell cannot be used. The concept of segue is not easy to develop, if it is a segue within the program, then you need to set the Dest View controller parameter information in the place of another callback. Summary

I weighed the pros and cons carefully, and the main problem was that my version management would be a disaster for many people collaborating on development, which was totally unacceptable. And the main advantage is that you can be in a similar whiteboard place "a mountain small" as the same understanding of all the interface between the switching relationship, but this is so important. I am actually very clear jump logic, this is just for new colleagues to understand the project code is helpful, then I spend a little time to tell him directly about painting is not done. It is completely unacceptable that versioning is not available for this benefit.

So in the end I decided to give up using storyboard, the "Look Beautiful" feature has an unacceptable flaw. Now it seems that it only applies to do some demo development. Apple has not handled this kind of visual interface design function version management, like the Xib file, although it is in XML format, but if more people edit, combined will be very troublesome. So many peers in the industry do not need to xib, directly with the pure code to write the interface, although a little slower, but the project is very clean, but also basically no more than a collaboration version of the conflict problem.

Posted by Tang Qiao Dec 15th, IOS

Original article, copyright statement: Free Reprint-non-commercial-non-derivative-keep the signature | Creative Commons by-nc-nd 3.0 share to: Sina micro bo NetEase micro bo Tencent Weibo renren more 3
A total of 0 people like a total of 10 Comments Log In

Publish chronological order Icoder (tourist) if because xib causes the cooperation of many people to produce code conflict can be circumvented, normally should each person responsible for a xib, if this xib place need others to deal with, that should be treated as a separate xib. Reply Top April 8 22:51 COSPERYPF (tourists) just a half a day when the text submitted to the landing and then actually put my words empty. Despise... The original play for more than half an hour ah ... Not all of it. I've developed a complete project using both storyboard and arc when I first came out, which solves the problem of frequent triple-interface switching in my project. I later saw a lot of storyboard articles are some of the storyboard slightly to understand the shallow conclusions of the people wrote, but I hope that we have a certain degree of acceptance of the new technology-to understand its deficiencies and must be prepared for good, after all, storyboard in the novice, Rapid framework construction and management, project handover and other aspects still have advantages, not to mention the use of storyboard and xib combination may also be a better way to manage the project. The main reason I didn't use storyboard and arc in my later projects was that the project requirements were supported to 4.3 and the two technologies required more than 5.0 version, that's all. My project was a do-it-yourself (in fact, most of my projects worked alone), but then I read and considered a little storyboard teamwork, and I was in http://iostrack.com/post/2012-08-18/ 40036669697 Summary of a article I think may be used, I tried to test the effectiveness of the code itself, feel reliable, but there is no chance to team work to practice. I hope I can initiate, let the use of storyboard people to introduce his use of experience for Up-and learning and learn from, rather than exclusively, after all, many problems in pushing us to a certain extent, we can always think of solutions.

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.