Comparison between IOS and ANDROID frameworks and application development modes

Source: Internet
Author: User

IOS and ANDROID operating systems are currently popular mobile operating systems and are widely used by mobile terminals and smart devices. They both adopt advanced software technologies for design, in order to facilitate application development, both adopt advanced design models. What technologies are used in the Framework Design? What design patterns are adopted? What are the similarities and differences between the two design ideas and the application development model?

  1. Both adopt the framework mode.

    The IOS framework is called Cocoa Touch.

    The Framework provides two functions: one is a collection of classes. Each class constructs a problem space and provides complete solutions and services. The other is that classes in the framework are mutually dependent and constitute a whole, develop and implement the entire application structure. The Framework defines a generic structure that provides an execution template for applications. Therefore, the implementation of many framework classes is abstract or intentionally incomplete, such classes usually implement a large number of common code, but make the important part of the work either incomplete or completed in a safe default mode.

    Because the application structure is generic, developers use hooks provided by the framework or other methods, such as subclass, to specialize them to meet the requirements of specific applications; designing an application is to insert the application code into the design provided by the Framework to complete the design, and the implementation of the Framework driver and management of the application lifecycle.

    To use the framework, developers must accept the application structure defined by the framework, and then use and customize its classes as much as possible to transform specific applications, to fit this structure.

    In a broad sense, the framework is like the framework of a house, and application code is like a door, a window, a wall panel, and other elements that make the House stand out.

    The IOS and ANDROID frameworks provide multiple methods for applications to modify and expand their common behaviors.

    One way to add application-specific behavior to the framework is to create a custom subclass of the framework class. Subclasses fill in the gaps in their superclasses and provide the missing parts of the framework classes. A custom subclass instance occupies its position in the object network defined by the framework and inherits the ability of the framework to cooperate with other objects. This design pattern is called the template pattern.

    For example, ANDROID uses this mode to customize application behavior. The ANDROID framework provides a general default implementation of four application components, ACTIVITY, SERVICE, Content providers, and Broadcast receivers, for applications. Applications subclass these components, you can complete application development by overwriting components as needed.

    However, IOS uses the delegate and Protocol modes to implement some specific behaviors of applications.

    In IOS, UIKit, one of the frameworks provided by Cocoa Touch, provides and manages the behavior of applications, including application startup and exit. The UIKit framework manages many core behaviors of applications.

    The UIKit framework includes a UIApplication object, which is the heart of an application. It receives events from the system and distributes the events to the custom code implemented by the application for processing.

    A specific application only needs to instantiate the UIApplication object without subclass. The specific behavior of an application is implemented by an application delegate object in the delegate and Protocol modes.

    When an application calls the UIApplicationMain function of the UIApplication object to start an application, it instantiates an application delegate object and passes it as a parameter to the UIApplicationMain function.

    As a subclass of UIResponder, the app delegate also implements the UIApplicationDelegate protocol to handle application-related events (mainly events that change the status of various applications) delegated by the UIApplication object ), to achieve application customization.

    The Protocol mode is one of the unique design modes used by The osx operating system framework. A protocol is a declaration of a programmable interface, and any class can implement its method. The class instance associated with the Protocol calls the Protocol method and obtains the values returned by the formal adoption and implementation of the Protocol. Such communication between objects produces a specific target, such as parsing XML code or copying objects. Objects on both sides of the Protocol interface can be inherited to implement remote correlation. As with delegation, the Protocol can be used as a subclass replacement method. The framework provided by Apple declares dozens of protocols.

    2. Application Development adopts the Model-View-controller (MVC) design mode.


    For example, The View Controller object in IOS framework acts as the controller in MVC mode and manages the presentation of application content on the screen. The View Controller is responsible for displaying and managing a single view and its sub-views, as well as the interaction between those views and other parts of the application. When rendering, The View Controller installs the views in the application window to display them.

    In the ios UIKit framework, the UIViewController class is the basic class of all View Controller objects. Each View Controller object is an instance of the UIViewController class and provides some default functions, it is used to load views, present views, and rotate views to respond to device rotation and several other standard system behaviors. During application implementation, you must subclass the UIViewController class to load a specific view of the application.

    UIKit and other frameworks define additional View Controller classes to implement standard system interfaces, such as selector, label bar interface, and navigation interface.

    The View Controller object provides a basic structure to manage content-related views and coordinate view display and hiding. View controllers are also used to manage sub-hierarchies of application views.

    Because the content displayed by the iOS application is limited, The View Controller also provides the required infrastructure to remove the view from one View Controller and replace it with the view in another view controller. Therefore, the view controller is a way for you to convert various types of content. A View Controller object can be used as a self-contained unit. It processes the creation and destruction of its own views and displays its views on the screen, coordinates the interaction between the view and other objects in the application.

    The application loads view controllers and related views by concatenating graphs or nib resource files. Concatenating graphs or nib resource files contains views and view controllers. Applications use them to display content on the screen. Views in A series chart are organized based on The View controllers that display them. A series chart also determines the conversion (called transition) of a group of views, bringing users from a group of views to another group.

    When you create a project, the name of the main concatenation graph file is specified by the NSMainStoryboardFile key in the Info. plist file contained in the application. For applications that use nib files (instead of concatenating graphs), you can use the NSMainNibFile key to replace the NSMainStoryboardFile key and use this key to specify the primary nib file to be used.


    The window in IOS framework corresponds to a UIWindow object, which coordinates the presentation of one or more views on the screen. Most applications only have one window to present content on the home screen, but the application may have another window to display the content on the external monitor.

    To change the content of your application, use the View Controller to change the view displayed in the corresponding window. You will not replace the window itself.

    In addition to serving as the host of the view, the window also works with the UIApplication object to send events to the view and View Controller.

    View objects in the IOS framework include views, control objects, layer objects, and other objects. Views and controls intuitively present the Content of applications. A view is used to draw content in a specified rectangular area and respond to events in this area. Control is a specialized view that implements common interface objects, such as buttons, text bars, and switching switches.

    View objects learn about the changes to model data through the Controller objects of the application, and send the modifications initiated by the user to the Model Objects of the application through the Controller objects.

    The UIKit framework provides standard views. Each view object is ultimately inherited from the UIView class and is used to present many types of content. You can also define your own custom view by directly subclass the UIView (or its subclass.

    In addition to views and controls, applications can also incorporate the Core Animation layer into their views and control layers. Layer objects are actually data objects that represent visual content. A view uses a large number of layer objects behind the scenes to render its content. You can also add custom layer objects to the interface to implement complex animations and other types of complex visual effects.

    The UIKit framework provides a view hierarchy. The view displayed by the application is arranged in a hierarchical structure (intuitively based on inclusion ). This mode allows applications to treat a single view as a merged view. The root of the hierarchy is a window object. Each view below the root has a parent view and zero or multiple child views. The parent view contains the child view. View hierarchy is a structural component for drawing and event processing.

    Model objects in the IOS framework can be used by the UIDocument objects provided by the UIKit framework to implement document-type data models. You can also define your own data model and related business logic based on the data types provided by the framework.

    IOS applications can also use the Core Data framework to create and implement model objects. Core Data provides a basic structure to manage modifications to model objects, store model objects in a file, and retrieve them back. The Core Data framework also provides many other features, such as automatic undo and redo, and maintaining the relationship between objects. It allows, only the subset of the model object is saved in the memory. The mode is used to describe the model object. The non-Intersection Set of the editing object is maintained. Version Management and migration of data storage are supported. Version Management allows you to easily upgrade user files of earlier versions to the current version. It allows you to store data in iCloud and then access data from multiple devices.

    The android system does not have an independent view controller object, but the ACTIVITY component of the application plays the View Controller role. It is used to create, load, and present views, load the data provided by the model object and update the data to the view through the model Adapter interface. The ACTIVITY is also responsible for updating the data model changes in the view to the model through the model adapter interface. The Adapter acts as the intermediary between the data model and the view.

    The window objects of the android system are not open to applications and are managed by the window management service of the framework.

    The android system also corresponds to an application window and corresponds to the root view object provided by the system. The view object is displayed in the window.

    Each View object in the android system inherits from the View class, including the View and ViewGroup objects. The ui of an application is constructed by a View tree composed of View and ViewGroup objects. View objects are used to draw content on the screen and interact with users, such as buttons or text fields. A ViewGroup object is a View container that can contain other View and ViewGroup objects to achieve the layout of the interface. ViewGroup objects and other View and ViewGroup objects contained in them are organized in the form of a View tree.

    The visual structure of the android app ui is defined by layout, a specific layout object. layout is a ViewGroup object. Including Linear Layout, Relative Layout, and Web View.

    A view object composed of multiple sub-Views on the application interface is loaded into the application for display by the setContentView function of the activity component that acts as the View Controller.

    The model object of android is provided mainly by Content providers and provided to the view through a model Adapter object provided by activity.

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.