UI--Storyboard advantages and disadvantages analysis

Source: Internet
Author: User
storyboard--looks beautiful Storyboard, sometimes called storyboarding, are often mixed. If your English is good enough, you may be able to appreciate the nuances. Before talking about storyboard, let's start with the background of Interface builder. Interface Builder abbreviation IB, is the Xcode development environment comes with the user graphical interface design tool, through which you can arbitrarily drag controls or objects (object) into the view. These controls are stored in a XIB (pronounced Zib) or in a nib file. XIB is easy to understand, plainly, the XIB file is an XML-formatted file that you can open to rewrite the XIB file by editing the tool. When the program compiles, these view controls are compiled into a nib file. Let's start with a basic understanding of nib. In general, NIB is associated with Viewcontroller, and many viewcontroller have corresponding nib files. The nib file is about describing the user interface, initializing the interface element object. In fact, the interface and initialization objects described by developers in NIB can be implemented in code. The reason for drawing pages with interface Builder is to reduce repetitive and tedious code that sets interface properties so that developers can focus on the implementation of the feature. Before Xcode 4.2, a corresponding xib file is generated for each view you create. When an app has multiple views, the jump management between views becomes complex. To solve this problem, Apple's Storyboard is timely and practical. Look at Apple's comments on storyboard: "Discover how Xcode's Interface Builder support for storyboarding in IOS 5 makes designing your IO S apps so much easier. Storyboarding allows-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. " The nib file cannot be described from one viewcontroller to another viewcontrOller jump, such jumps can only be achieved by handwritten code. I believe many people will often use-presentmodalviewcontroller:animated: and-pushviewcontroller:animated: These two methods. The advent of storyboarding makes this approach a history, replaced by Segue [Segwei]. Segue defines a jump from one viewcontroller to another viewcontroller. In IB, we are already familiar with how to connect the meeting element objects and methods (Action method). In Stroyboard, we can connect Viewcontroller with segue, without the need for handwritten code anymore. If you want to customize Segue, you can simply write the Segue implementation without writing the calling code, Storyboard will call it automatically. To use a good storyboard mechanism, we must strictly abide by the MVC principle. The View and controller need to be fully decoupled, and the different controllers must be fully decoupled. When developing an iOS application, there are two ways to create a view, one of which is to drag a UIView control in interface Builder, and the other way through native code. Both approaches have pros and cons. The IB approach seems simple, but it is inconvenient to navigate between the view, and the native code (this pure handwritten code) is a huge effort. Even if you just create a few labels, you have to write hundreds of lines of code, and each label has to set coordinates. To address the above issues Apple recently released the IOS5 new Storyboard feature. What Storyboard is. Simply put, storyboard is a tool that comes with Xcode 4.2 and is used primarily for iOS5 or more. The view created by the early Interfacebuilder is independent of each other and is not interrelated, and when an application has multiple view, the jump between the view is very complex. For this reason, Apple brings the gospel-storyboard to developers. Especially with the use of navigation bars and tab bars, Storyboard greatly simplifies the switching between views, and thus simplifies the development of the management view controller, and we can specify the order in which views are toggled, rather than writing code manually. Storyboard can contain all the Viewcontroller of a programand the connections between them. In app development, UI flow can be used as input to storyboard, and a seemingly complete UI is at storyboard's fingertips.

DEC 15TH, introduction

Storyboard is the new feature of Storyboarding Builder introduced by Apple in the 2011 WWDC Session 309 Introducing Interface builder Interface. The basic idea is to upgrade the original xib, introduce a container for managing multiple Xib files, and this container can jump through the interface between the Xib and drag settings. And this container is what Apple calls the storyboard. The following image is a screenshot of a storyboard.

Advantages

Overall, storyboard has the following benefits: You can easily comb out the call relationships between all view controller interfaces from the storyboard. This is more friendly to the new team of developers who have joined the project. Use storyboard to use the static cell function of the table View controller. For the development of some cells, but each cell is not the same list class setting interface is more convenient. By implementing-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender method, each view controller's jump logic is gathered in one place, This facilitates our unified management interface to jump and pass data. Storyboard can be easily modularized and reused for some common functions. For example, WWDC2011 introduces storyboard's video to modularize the microblog sharing function into a single storyboard. When I was developing the app, I would make a separate storyboard for example through a third-party registration login module for later reuse. Disadvantages

When I used storyboard in my new project, I found that it just looked beautiful, actually used it, but there were a lot of problems, and the problem I found was: first it's like Xib, it's a disaster for version management. Because it's actually a collection of multiple xib, it's easier to have multiple-person edits conflict. Apple's design of the storyboard is not good, basically you just open, do nothing, this file will be changed, so the conflict is almost inevitable-unless you do not open, really accidentally opened to look, you need to back up to the server version before submission. The Static cell attribute provided by storyboard is only suitable for subclasses of Uitableviewcontroller. Most of the time I use a tableview nested in another uiview, the static cell cannot be used. The concept of segue is not a hassle for development, and if you trigger a segue inside a program, you need to set the parameter information for the Dest View controller in another callback. Summary

I carefully compared the pros and cons, the main problem is that my version management in the multi-person collaborative development will be in disaster, and this is completely unacceptable. The main advantage is that you can see the switching relationship between all the interfaces in a whiteboard-like place, "a little mountain", but is that important? I am actually very clear about the jump logic, this is only for the new colleague to understand the project code is helpful, then I spend a little time directly to him to tell the painting is not done. For this benefit, versioning is not available and is completely unacceptable.

So in the end I decided to abandon the use of storyboard, this "looks beautiful" function has an unacceptable flaw. Now it seems that it only applies to the development of some demos. Apple has not managed to manage this kind of visual interface design feature version management, like Xib file, although it is in XML format, but if many people edit, the merger will be very troublesome. So many industry peers do not have to xib, directly with the pure code to write the interface, although slightly slower, but the project is very clean, there is no more than the version of the conflict problem of collaboration.

Posted by Tang Qiao Dec 15th, IOS

Original article, copyright notice: Free Reprint-Non-commercial-non-derivative-retain attribution | Creative Commons by-nc-nd 3.0 share to: Sina Weibo NetEase Weibo Tencent Weibo Renren watercress more 3
Total 0 people like Total 10 reviews Login

Publish by Time Icoder (tourist) if it is possible to circumvent a code conflict because Xib leads to multiple co-operation, each person should normally be responsible for a xib, and if there is a place in the xib that needs to be handled by someone else, it should be treated as a separate xib. Reply Top April 8 22:51 cosperypf (tourist) just base for half a day when the text is submitted to the landing and then actually emptied my words. Despise... It's been over half an hour. Not all of them. I've developed a complete project with both storyboard and arc just out of the box, which solves the problem of frequent three-interface switching in my project. I later saw a lot of storyboard articles are some of the storyboard to understand the shallow conclusion of the people wrote, but I hope you have a certain degree of acceptance of the new technology-to understand its shortcomings and to be prepared for it, after all, storyboard in the novice, Rapid frame construction and management, project handover and other aspects of the 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 for my later projects was that the project required support to 4.3 and the two technologies required version 5.0 or more, that's all. My project is done on the go (in fact, most of my projects are done alone), but then I saw and considered a little storyboard of teamwork, and I was http://iostrack.com/post/2012-08-18/ 40036669697 a summary of what I think might be used, I tried the validity of the code itself, feel reliable, but there is no opportunity for teamwork to practice. I hope I can make a point, let the use of storyboard more to introduce his use of experience for Yimeimei learning and reference, and not exclusively said bad, after all, a lot of problems in pushing us to a certain extent, we can always think of ways to solve.
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.