Interface rendering method and device based on iOS application

By using the JSON configuration file and the characteristics of iOS, analysis and rendering the iOS application page, the problem of dynamic and rendering performance in existing technologies is difficult to balance, and efficient rendering and low threshold development have been achieved.

CN114020358BActive Publication Date: 2025-01-28工银科技有限公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111312693.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-08
Publication Date
2025-01-28
Estimated Expiration
2041-11-08

AI Technical Summary

Technical Problem

The existing technology cannot effectively balance the dynamics and rendering performance of iOS applications, resulting in low development efficiency, poor user experience, and hardware call limitations.

Method used

By using the JSON configuration file to describe the application page, use the characteristics of iOS to analyze and render the configuration file, generate virtual trees and map it to view components to achieve dynamic updates and efficient rendering.

Benefits of technology

The needs of dynamic application of application have been achieved, the page rendering performance has been improved, the development threshold is reduced, the hardware calls are avoided, and the development efficiency and user experience are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114020358B_ABST
    Figure CN114020358B_ABST
Patent Text Reader

Abstract

The present invention provides an interface rendering method and device based on iOS applications, which belongs to the field of cloud computing technology and can be applied to the financial field or other fields. The interface rendering method based on iOS applications includes: obtaining the corresponding root view stack bottom page instance in response to page creation requirements, parsing the page subview corresponding to the root view stack bottom page instance to generate a virtual tree; mapping the virtual tree to the view component to create a subview instance, generating a view instance according to the subview instance and the root view stack bottom page instance; searching for the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance; binding the method responder corresponding to the method implementation with the method implementation, and writing the bound method implementation into the method definition. The present invention can meet the requirements of application dynamics, improve page rendering performance, improve development efficiency, and avoid hardware call restrictions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to an iOS application-based interface rendering method and device. Background Art

[0002] With the rapid development of computer technology and the popularity of various mobile devices, various user needs are fed back and realized through feature-rich software applications. However, user needs are constantly changing. In order to provide better and faster software services to meet the changing actual needs of users, application development needs to frequently update versions to meet new needs. Due to the influence of native development and Objective-C language characteristics, the iOS application development cycle is relatively long, and version updates and iterations cannot keep up with business changes. Therefore, how to lower the development threshold and improve application development efficiency has become an urgent problem to be solved. The following technologies are usually used in the current application development process to solve such problems:

[0003] 1. StoryBoard is a new technology introduced by Apple in iOS5 and is the interface development method that Apple has always recommended. This tool is integrated into Xcode, an IDE tool developed by Apple. It is a visual interface editing tool that uses XML description at the bottom layer and has the advantage of WYSIWYG. Its disadvantages are poor dynamics and rendering performance, poor reusability, and poor performance in team collaborative development.

[0004] 2. ReactNative is a React-based Javascript framework that was open-sourced by FaceBook in 2015. It is designed to efficiently develop mobile applications using Javascript. ReactNative supports cross-end development, but cannot completely block the native platform. The code is simple to write and is more dynamic. Its disadvantages are that the page rendering performance is relatively poor (this disadvantage is caused by its underlying rendering logic) and low stability.

[0005] 3. ComponentKit is an iOS native UI development framework based on React launched by FaceBook. ComponentKit uses functional and declarative methods to create interfaces, and uses a one-way data flow to map from immutable models to immutable components to determine how views are displayed. ComponentKit has good rendering performance and can be regarded as a native version of ReactNative. Its disadvantages are that developers need to be familiar with ObjC++, the development threshold is high, the development efficiency is low, and the support for complex interface logic is relatively poor.

[0006] 4. Hybrid application: A hybrid architecture of part H5 and part Native, based on the dynamic nature of H5, and achieving dynamic nature by defining Native extensions (Bridge); the feature is that the interface rendering is completed by HTML and CSS, and the underlying logic is implemented through native code bridging; the disadvantages are poor performance, strong dependence on the network, and poor user experience.

[0007] In terms of improving application development efficiency and lowering development thresholds, existing technologies have the following shortcomings:

[0008] 1. Unable to balance application dynamics and rendering performance. Often, good dynamic performance of an application will lead to poor rendering performance. Existing technologies have made many attempts to dynamically update apps, such as using JSPatch for pure native development and hot updates, or using Html5 for hybrid development. However, JSPatch is disabled by the iOS platform and cannot pass the review of the iOS platform; while Html5 has high network requirements and poor rendering capabilities for page content.

[0009] 2. Unable to balance application development efficiency and application user experience. In actual development, non-native technologies are often used to develop applications to improve development efficiency, but non-native technologies cannot fully realize the page effects supported by native technologies.

[0010] 3. Mobile hardware call limitations: Due to the limitations of non-native technologies themselves, such as Hybrid mobile applications cannot directly access device hardware and offline storage, there are great limitations in experience and performance. Summary of the invention

[0011] The main purpose of the embodiments of the present invention is to provide an interface rendering method and device based on iOS applications to meet the needs of application dynamics, improve page rendering performance, improve development efficiency, and avoid hardware call limitations.

[0012] In order to achieve the above object, an embodiment of the present invention provides an interface rendering method based on iOS application, comprising:

[0013] In response to the page creation requirement, obtain the corresponding page instance at the bottom of the root view stack, parse the page subviews corresponding to the page instance at the bottom of the root view stack to generate a virtual tree;

[0014] Map the virtual tree to the view component to create a subview instance, and generate a view instance based on the subview instance and the bottom page instance of the root view stack;

[0015] Find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack;

[0016] Bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0017] The embodiment of the present invention further provides an interface rendering device based on iOS application, comprising:

[0018] A virtual tree generation module is used to obtain the corresponding root view stack bottom page instance in response to page creation requirements, and parse the page subviews corresponding to the root view stack bottom page instance to generate a virtual tree;

[0019] A view instance generation module is used to map the virtual tree to the view component to create a sub-view instance, and to generate a view instance according to the sub-view instance and the bottom page instance of the root view stack;

[0020] The method implementation module is used to find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack;

[0021] The binding writing module is used to bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0022] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the steps of the interface rendering method based on iOS application are implemented.

[0023] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the interface rendering method based on iOS applications are implemented.

[0024] The interface rendering method and device based on iOS application in the embodiment of the present invention first responds to the page creation demand to obtain the corresponding root view stack bottom page instance to generate a virtual tree, and then maps the virtual tree to the view component to create a sub-view instance, generates a view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the configuration file for the corresponding method implementation according to the method definition of the root view stack bottom page instance to bind the corresponding method responder with the method implementation and then write the method implementation into the method definition, which can meet the application dynamic requirements, improve page rendering performance, improve development efficiency, and avoid hardware call limitations. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 is a flow chart of an interface rendering method based on iOS application in an embodiment of the present invention;

[0027] Figure 2 is a flowchart of an interface rendering method based on iOS application in another embodiment of the present invention;

[0028] Figure 3 is a flow chart of an interface rendering method based on iOS application in another embodiment of the present invention;

[0029] Figure 4 is a flowchart of creating a view component in an embodiment of the present invention;

[0030] Figure 5 is a flow chart of writing parsing results into a view component in an embodiment of the present invention;

[0031] Figure 6 is a flowchart of generating a bottom page instance of a root view stack in an embodiment of the present invention;

[0032] Figure 7 is a schematic diagram of an interface rendering device based on iOS applications in an embodiment of the present invention;

[0033] Figure 8 is a structural block diagram of an interface rendering device based on iOS applications in another embodiment of the present invention;

[0034] Fig. 9 yes Figure 8 Functional flow diagram of the module in the figure;

[0035] Fig.10 It is a structural block diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0038] The key terms mentioned in this invention are defined as follows:

[0039] Objective-C language: The main development language for iOS native apps. This language is an extension of C and Smalltalk, and is a superset of C. The biggest difference is that OC is object-oriented. The mobile Internet ecosystem has brought about the rise of Objective-C language.

[0040] Objective-C is a dynamic language that moves many things that static languages ​​do during compilation and linking to runtime. For Objective-C, the runtime system is like an operating system: it allows everything to run normally. The runtime is basically written in C and assembly language, which gives the C language object-oriented capabilities. In the runtime, objects can be represented by structures in the C language, and methods can be implemented by C functions, with some additional features. After these structures and functions are encapsulated by runtime functions, object-oriented programming in OC becomes possible.

[0041] Storyboard: A function integrated into the IDE tool Xcode. It is a visual interface editing tool and uses XML description at the bottom layer.

[0042] Native: In the present invention, it refers to the use of iOS development-related development languages, development libraries and development tools to develop Apps.

[0043] Dynamicity: Dynamicity refers to the ability to execute dynamically through the background. This feature can reduce the manpower and time costs of terminal version releases, and users can quickly obtain the latest version of the service. It is a relatively important feature in the mobile Internet era.

[0044] Block: Block is a C language extension introduced in iOS 4. Block is an anonymous function with automatic variable (local variable) values. As the name implies, it is an unnamed function with automatic variable (local variable) values. Block is widely used in iOS development.

[0045] In view of the fact that the existing technology cannot balance the dynamics of applications and rendering performance, cannot balance the development efficiency of applications and the user experience of applications, and has hardware call limitations, an embodiment of the present invention provides an interface rendering method based on iOS applications, which uses a configuration file with specific rules to parse the configuration file content during the operation of the application, and uses the runtime characteristics of iOS development to interpret and render the pages corresponding to the configuration file to bring about efficient page rendering. The configuration file uses the JSON data format, which is a lightweight data exchange text format that is completely independent of the language. These characteristics make JSON an ideal data exchange language that is easy for people to read and write, and is also easy for machines to parse and generate. By combining the easy-to-write characteristics of the JSON data format and the runtime characteristics of iOS native development, the following technical problems can be solved:

[0046] 1. Meet the needs of application dynamism. Use the configuration file as the description of the application page, and present the complete application page by interpreting the configuration file and matching the corresponding page rendering rules; dynamically update the application content by dynamically updating the configuration file to meet the needs of application dynamism.

[0047] 2. Improve page rendering performance. By utilizing the iOS runtime features, page rendering is actually implemented by the rendering framework of the iOS system, and rendering performance is effectively guaranteed.

[0048] 3. Encoding reuse. Portable and modifiable configuration files have unified rendering results under a unified interpretation method. Configuration files can be reused to avoid repeated encoding.

[0049] 4. Based on iOS native, avoid native hardware call restrictions. iOS native development can directly call the hardware devices that the system allows access to obtain relevant input data.

[0050] 5. Lower the development threshold. Users do not need to understand OC language and iOS development. They only need to use the configuration file to get the required app.

[0051] The present invention introduces a configuration file, and there is no need to write any native development code. A complete application can be obtained through parsing and rendering by a rendering engine. The present invention is described in detail below with reference to the accompanying drawings.

[0052] Figure 1 It is a flow chart of an interface rendering method based on iOS application in an embodiment of the present invention. Figure 2 FIG. 1 is a flow chart of an interface rendering method based on iOS application in another embodiment of the present invention. Figure 1 and Figure 2 As shown, the interface rendering method based on iOS application includes:

[0053] S101: Responding to a page creation requirement, obtaining a corresponding page instance at the bottom of the root view stack, parsing the page subviews corresponding to the page instance at the bottom of the root view stack, and generating a virtual tree.

[0054] In specific implementation, you can first register the application page defined in the configuration file, then respond to the page creation requirements to obtain the corresponding root view stack bottom page instance from the block, and parse the configuration file to generate a virtual tree for the page subview corresponding to the root view stack bottom page instance.

[0055] The bottom page instance of the root view stack is generated through the root view configuration file. The root view is the bottom controller of the application view, which can be a navigation controller or a selection controller (tabbar controller). The controller is a stack structure, which provides pop and push methods for loading and disappearing new pages.

[0056] Figure 3 FIG. 1 is a flowchart of an interface rendering method based on an iOS application in another embodiment of the present invention. Figure 3 As shown, the configuration file settings include:

[0057] 1. Use the configuration file editor or other tools to generate the application's configuration file according to the established rules. The configuration file includes the global general configuration file, the root view file, the page registration file, and each page file. You can choose the configuration file editor based on the developer's development habits, or develop a custom configuration file editor to improve the efficiency of configuration file writing.

[0058] 2. The application loads the configuration file. Start the application and obtain the configuration file from the server or the local application. When loading the configuration file, you need to set a specified loading method so that the engine can confirm the source of the configuration file. You can also set a reasonable loading strategy to ensure the completeness of the application loading logic.

[0059] Among them, you can choose to build the configuration file into the application as a resource file according to the actual development situation, or modify the page by actively importing it. Dynamic update can be achieved by combining the configuration file that meets the rules with a certain update logic.

[0060] 3. Parse and verify the configuration file, including:

[0061] 1) Integrity check: the application configuration file must be complete.

[0062] 2) Legality verification: the correctness of the JSON data format of the configuration file, and no missing fields.

[0063] 3) Version verification: check the version information of the configuration file to confirm that it is an available version.

[0064] Figure 6 is a flowchart of generating a root view stack bottom page instance in an embodiment of the present invention. Figure 6 As shown, generating the bottom page instance of the root view stack includes:

[0065] S401: Register the class corresponding to the iOS application, and add method definition and property definition to the class.

[0066] In specific implementation, the configuration file can be read to register the classes corresponding to the IOS application and store these classes in the device memory: utilizing the iOS runtime characteristics, using Runtime to dynamically register the classes defined in the configuration file, and adding corresponding method definitions and property definitions to the classes.

[0067] S402: Generate page data according to the class to which methods and attributes are added.

[0068] S403: Generate a bottom page instance of the root view stack according to the configuration file and page data.

[0069] After obtaining the corresponding root view stack bottom page instance, it also includes: reading the attribute value corresponding to the attribute definition of the root view stack bottom page instance from the configuration file; assigning the attribute definition of the root view stack bottom page instance according to the attribute value, and the assignment content may include page background color, navigation bar status, navigation bar title and entry animation, etc.

[0070] S102: Map the virtual tree to the view component to create a sub-view instance, and generate a view instance according to the sub-view instance and the bottom page instance of the root view stack.

[0071] Among them, view components include iOS system components or custom components. System components include UIView, UILabel, UIButton and UIImageView, etc. The iOS runtime mechanism is used to generate view instances based on subview instances and the bottom page instance of the root view stack.

[0072] S103: Searching for a corresponding method implementation from a configuration file according to the method definition of the bottom page instance of the root view stack.

[0073] S104: Bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0074] After binding the method responder corresponding to the method implementation to the method implementation, you can call the method to handle the page jump method through the message sending mechanism in the iOS runtime, or you can handle any method that clearly defines the receiver and method implementation.

[0075] After binding the method responder corresponding to the method implementation to the method implementation, you can also set the layout information of the view through the following process:

[0076] Search the layout information data of the corresponding component in the configuration file, determine the dependent component corresponding to the view component from the layout information data; traverse all the dependent constraint information of the dependent component, determine the constraint relationship in the dependent constraint information according to the view component and the dependent component, and write the constraint relationship into the view component. The constraint relationship includes the top, bottom, left, right, and center position relative to the dependent component, as well as the width and height of the dependent component itself or the aspect ratio relative to the dependent component.

[0077] Figure 1 The execution subject of the interface rendering method based on iOS application shown can be an application program. Figure 1 As can be seen from the process shown, the interface rendering method based on iOS application in the embodiment of the present invention first responds to the page creation demand to obtain the corresponding root view stack bottom page instance to generate a virtual tree, and then maps the virtual tree to the view component to create a sub-view instance, generates a view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the configuration file for the corresponding method implementation according to the method definition of the root view stack bottom page instance to bind the corresponding method responder to the method implementation and then write the method implementation into the method definition, which can meet the application dynamic requirements, improve page rendering performance, improve development efficiency, and avoid hardware call limitations.

[0078] Figure 4 FIG. 1 is a flowchart of creating a view component in an embodiment of the present invention. Figure 4 As shown, after executing S104, the interface rendering method based on the iOS application further includes:

[0079] S201: registering a page data model class, generating a data request according to an instance corresponding to the page data model class, and sending the data request to a corresponding interface address.

[0080] In specific implementation, the interface (API) address corresponding to the page data model class can be read from the configuration file, the corresponding data model part can be found from the configuration file, the attributes in the data model can be added to the corresponding registered class to register the data model class, and the data model class can be stored in memory.

[0081] S202: Parse the data returned by the interface address, and write the parsing result into the view component.

[0082] Figure 5 is a flow chart of writing the parsing results into the view component in an embodiment of the present invention. Figure 5 As shown, writing the parsing results to the view component includes:

[0083] S301: Write the parsing result into the attribute of the instance corresponding to the page data model class.

[0084] S302: Bind the attributes written into the parsing result to the view component according to the binding relationship file.

[0085] In one embodiment, a binding relationship file may be obtained from a configuration file, and data binding may be performed between the attributes written into the parsing result and the attributes in the view component according to the binding relationship file.

[0086] S303: Write the properties of the parsing result into the properties of the view component.

[0087] After executing S303 , the page data needs to be refreshed.

[0088] The specific process of the embodiment of the present invention is as follows:

[0089] 1. Register the class corresponding to the IOS application and add method definitions and property definitions to the class.

[0090] 2. Generate page data based on the classes with added methods and attributes.

[0091] 3. Generate the bottom page instance of the root view stack based on the configuration file and page data.

[0092] 4. Read the attribute value corresponding to the attribute definition of the bottom page instance of the root view stack from the configuration file, and assign the attribute definition of the bottom page instance of the root view stack according to the attribute value.

[0093] 5. Respond to the page creation requirements to obtain the corresponding root view stack bottom page instance, parse the page subviews corresponding to the root view stack bottom page instance to generate a virtual tree.

[0094] 6. Map the virtual tree to the view component to create a subview instance, and generate a view instance based on the subview instance and the bottom page instance of the root view stack.

[0095] 7. Find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack.

[0096] 8. Bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0097] 9. Determine the dependent components corresponding to the view component, determine the constraint relationship based on the view component and the dependent components, and write the constraint relationship into the view component.

[0098] 10. Register the page data model class, generate a data request according to the instance corresponding to the page data model class, and send the data request to the corresponding interface address.

[0099] 11. Parse the data returned by the interface address and write the parsing results into the attributes of the instance corresponding to the page data model class.

[0100] 12. Bind the properties written into the parsing results to the view components according to the binding relationship file.

[0101] 13. Write the properties of the parsing results into the view component.

[0102] In summary, the interface rendering method based on iOS application provided by the embodiment of the present invention has the following beneficial effects:

[0103] (1) Lower the threshold for application development and improve application development efficiency. Use JSON data as the data format of the configuration file, and take advantage of the easy-to-write and easy-to-read characteristics of JSON data to effectively reduce the development difficulty for developers. After becoming familiar with the writing rules of the configuration file, non-developers can also edit the configuration file to write pages.

[0104] (2) Improve page rendering performance while ensuring dynamicity. The application configuration file can be updated by sending a configuration file from the server, interpreting the updated configuration file, and calling the iOS system rendering framework to render the page. The existing technical solutions sacrifice part of the system performance by using a browser to load the H5 page or implement a custom rendering strategy. The present invention utilizes the iOS runtime characteristics when rendering the page, and fully uses the system characteristics to call the system rendering framework, which not only ensures the dynamic update of the application, but also solves the performance loss problem of the existing technical solutions. ;

[0105] (3) Improve code reusability and reduce development costs. A complete system configuration file corresponds to a complete application, and a single rule-complete configuration file corresponds to a complete page. Therefore, the reusability of the page only depends on the rendering engine described in the present invention. As long as the rendering engine configuration file is introduced, it can be reused. By continuously improving and updating the configuration file, the present invention can expand a set of basic and advanced components of an application program, which serves as a powerful productivity for application programming;

[0106] (4) The existing rendering engine only renders pages through the rendering tree. The push and push logic between pages and the complex processing logic of the page stack require additional native logic code. However, the present invention can handle the jump logic between pages.

[0107] The data of the existing rendering engine can only be pre-defined fixed data, while the present invention can request the latest data through a dynamic interface and perform model conversion and binding filling of view data, and can also interact with user events through dynamic processing. Users only need to import or issue configuration files to complete the functional development of the complete APP without writing code.

[0108] Based on the same inventive concept, an embodiment of the present invention also provides an interface rendering device based on iOS applications. Since the principle of solving the problem by the device is similar to that of the interface rendering method based on iOS applications, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0109] Figure 7 It is a schematic diagram of an interface rendering device based on iOS application in an embodiment of the present invention. Figure 8 It is a structural block diagram of an interface rendering device based on iOS application in another embodiment of the present invention. Fig. 9 yes Figure 8 Schematic diagram of the functional flow of the modules. Figure 7-Figure 9 As shown, the interface rendering device based on iOS application includes:

[0110] A virtual tree generation module is used to obtain the corresponding root view stack bottom page instance in response to page creation requirements, and parse the page subviews corresponding to the root view stack bottom page instance to generate a virtual tree;

[0111] A view instance generation module is used to map the virtual tree to the view component to create a sub-view instance, and to generate a view instance according to the sub-view instance and the bottom page instance of the root view stack;

[0112] The method implementation module is used to find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack;

[0113] The binding writing module is used to bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0114] like Figure 8-Figure 9 As shown, in actual application, the interface rendering device based on iOS application includes:

[0115] 1. Configuration file generation module, which is used to write the configuration file required by the rendering engine. The rendering engine generates a complete application through the configuration file. The configuration file type is a json file, including:

[0116] 1) Global theme definition file, mainly used to configure the overall style of the application, including: theme color, navigation bar style, status bar style and other basic styles of the components required by the application.

[0117] 2) The root view controller file is mainly used to determine the type of the application's root view, including: general default style, top navigation style (UINavigationController), bottom navigation style (UITabBarController), etc.

[0118] 3) Page file. Each page of the application corresponds to a page configuration file, which mainly includes:

[0119] a) Basic configuration information of the page, such as the unique identifier, name, and type of the page.

[0120] b) Virtual tree structure of subviews in a page. A page is composed of multiple controls in a specific hierarchical structure. The virtual tree structure of a page records the hierarchical structure of all controls on the page.

[0121] c) Layout constraint information of subviews. The hierarchical structure of controls on a page forms a certain subordinate relationship. Each control has its own subordinate view. This view is called the parent view relative to the control, and the control is called the subview relative to the parent view. The layout constraint information of the subview is to determine the position information of each control on the page to facilitate page layout.

[0122] d) Data binding relationship between pages and subviews. Pages and subviews on pages are used to carry certain business information. Determining the data binding relationship is to determine the business data carried by the subview. The bound data identifier facilitates the assignment of the content presented by the view.

[0123] e) Event processing logic of pages and subviews. Pages and subviews on pages carry certain user interaction logic, which carries user behavior events. By defining event processing logic, user interaction is completed in the program by triggering these events.

[0124] 4) Registration file, which is mainly used to store the registration information of each page of the application so that the rendering engine can quickly find the corresponding page information.

[0125] 2. Dynamic code generation module. Runtime is a set of underlying pure C language APIs. The OC code will eventually be converted into runtime code by the compiler. The function call method is determined by the message mechanism, which is also the basis for using OC as a dynamic language. The dynamic code generation module uses the iOS runtime characteristics and uses Runtime to dynamically generate the classes defined in the registration file, and add the required properties, methods and events in the class. During the execution of the application, the classes required for page rendering are dynamically generated. These classes do not actually correspond to resource files but are only stored in memory. When needed, instance objects of the class are generated, and the instance objects follow the memory management rules of the iOS system.

[0126] 3. Registration module. Generate the "page instance block code block" of the corresponding page through the page registration data defined in the registration file. The block code block is an anonymous function with the value of automatic variables (that is, local variables). After the page instance block code block is registered and generated, whenever the page needs to be displayed, the page instance is generated by calling the block code block corresponding to the page.

[0127] 4. The rendering module includes a virtual tree generation module and a view instance generation module, which is used to parse the page file. The process is as follows:

[0128] 1) Perform basic configuration of the page and assign the basic information of the page in the configuration file to the page instance.

[0129] 2) Parse the subview description in the page configuration to generate a virtual view tree.

[0130] 3) According to the configuration file and the virtual view tree, correspond to the basic components, and load each subview onto the page by traversing the view tree.

[0131] 4) Add position constraint information and width and height information to the subviews through the layout description in the configuration file to fully render the page.

[0132] 5. The data binding module, including the method implementation module and the binding writing module, has the following two functions:

[0133] 1) Bind the data binding rules agreed upon by each view in the page configuration file to the corresponding attributes in the generated page instance.

[0134] 2) Use the server API address specified in the configuration file to make a data request, parse the request result, and fill the data of each subview with the parsed result according to the data rules specified in the configuration file.

[0135] 6. Event processing module:

[0136] 1) Event processing is implemented by using the event reflection mechanism of Objective-C, the iOS application development language. The iOS system Foundation framework provides developers with some method reflection APIs, which can be used to perform operations such as converting strings into SEL (a pointer to a class member method, but different from a function pointer in C language, a function pointer directly stores the address of the method, but SEL is only a method number). Due to the dynamic nature of the OC language, these operations all occur at runtime. You can choose to create a specified instance at runtime and dynamically choose which method to call. These operations can even be controlled by the parameters sent back by the server. Therefore, the iOS message mechanism is used to agree on the Target and IMP (a function pointer that stores the address of the method) of the event, and then call the pre-agreed method processing logic.

[0137] 2) Event processing through routing. The present invention includes a custom page routing component that can create corresponding routes for each page. Event processing such as push, push and jump between pages is performed through the routing component and the routing information agreed upon by the page. The routing component can also transfer data between pages when the page jumps.

[0138] In summary, the interface rendering device based on iOS application in the embodiment of the present invention first responds to the page creation demand to obtain the corresponding root view stack bottom page instance to generate a virtual tree, and then maps the virtual tree to the view component to create a sub-view instance, generates a view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the configuration file for the corresponding method implementation according to the method definition of the root view stack bottom page instance to bind the corresponding method responder to the method implementation and then write the method implementation into the method definition, which can meet the application dynamic requirements, improve page rendering performance, improve development efficiency, and avoid hardware call limitations.

[0139] The embodiment of the present invention also provides a specific implementation of a computer device that can implement all the steps in the interface rendering method based on iOS application in the above embodiment. Fig.10 is a block diagram of a computer device in an embodiment of the present invention, see Fig.10 , the computer equipment specifically includes the following contents:

[0140] Processor (processor) 1001 and memory (memory) 1002.

[0141] The processor 1001 is used to call the computer program in the memory 1002. When the processor executes the computer program, all steps in the interface rendering method based on iOS application in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0142] In response to the page creation requirement, obtain the corresponding page instance at the bottom of the root view stack, parse the page subviews corresponding to the page instance at the bottom of the root view stack to generate a virtual tree;

[0143] Map the virtual tree to the view component to create a subview instance, and generate a view instance based on the subview instance and the bottom page instance of the root view stack;

[0144] Find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack;

[0145] Bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0146] In summary, the computer device of the embodiment of the present invention first responds to the page creation demand to obtain the corresponding root view stack bottom page instance to generate a virtual tree, and then maps the virtual tree to the view component to create a sub-view instance, generates a view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the configuration file for the corresponding method implementation according to the method definition of the root view stack bottom page instance to bind the corresponding method responder to the method implementation and then write the method implementation into the method definition, which can meet the application dynamic requirements, improve page rendering performance, improve development efficiency, and avoid hardware call limitations.

[0147] The embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the interface rendering method based on iOS applications in the above embodiment. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the interface rendering method based on iOS applications in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0148] In response to the page creation requirement, obtain the corresponding page instance at the bottom of the root view stack, parse the page subviews corresponding to the page instance at the bottom of the root view stack to generate a virtual tree;

[0149] Map the virtual tree to the view component to create a subview instance, and generate a view instance based on the subview instance and the bottom page instance of the root view stack;

[0150] Find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack;

[0151] Bind the method responder corresponding to the method implementation to the method implementation, and write the bound method implementation into the method definition.

[0152] In summary, the computer-readable storage medium of an embodiment of the present invention first responds to the page creation requirement to obtain the corresponding root view stack bottom page instance to generate a virtual tree, and then maps the virtual tree to the view component to create a sub-view instance, generates a view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the configuration file for the corresponding method implementation according to the method definition of the root view stack bottom page instance to bind the corresponding method responder to the method implementation and then write the method implementation into the method definition, which can meet the application dynamic requirements, improve page rendering performance, improve development efficiency, and avoid hardware call limitations.

[0153] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

[0154] Those skilled in the art may also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention may be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.

[0155] The various illustrative logic blocks, or units, or devices described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.

[0156] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal. Optionally, the processor and the storage medium can also be arranged in different components in the user terminal.

[0157] In one or more exemplary designs, the above functions described in the embodiments of the present invention can be implemented in hardware, software, firmware or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium, or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one place to another. The storage medium can be any available medium that can be accessed by any general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program codes in the form of instructions or data structures and other forms that can be read by general or special computers, or general or special processors. In addition, any connection can be appropriately defined as a computer-readable medium, for example, if the software is transmitted from a website site, server or other remote resource through a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wirelessly, such as infrared, wireless and microwave, it is also included in the defined computer-readable medium. The disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk and blue-ray disk. Disks usually copy data magnetically, while discs usually copy data optically with lasers. The above combination can also be included in computer readable media.

Claims

1. An interface rendering method based on iOS application, characterized in that: include: In response to the page creation requirement, obtain the corresponding root view stack bottom page instance, parse the page subview corresponding to the root view stack bottom page instance to generate a virtual tree; Mapping the virtual tree to a view component to create a sub-view instance, and generating a view instance according to the sub-view instance and the bottom page instance of the root view stack; According to the method definition of the bottom page instance of the root view stack, the corresponding method implementation is searched from the configuration file; Binding a method responder corresponding to the method implementation to the method implementation, and writing the bound method implementation into the method definition; The steps of generating the bottom page instance of the root view stack include: Register the class corresponding to the iOS application, and add the method definition and the property definition of the bottom page instance of the root view stack to the class; Generate page data based on the class with added methods and attributes; Generate the bottom page instance of the root view stack according to the configuration file and the page data.

2. The interface rendering method based on iOS application according to claim 1, characterized in that: Also includes: Registering a page data model class, generating a data request according to an instance corresponding to the page data model class, and sending the data request to a corresponding interface address; The data returned by the interface address is parsed, and the parsing result is written into the view component.

3. The interface rendering method based on iOS application according to claim 2, characterized in that: Writing the parsing result into the view component includes: Writing the parsing result into the attribute of the instance corresponding to the page data model class; Binding the attributes written into the parsing result to the view component according to the binding relationship file; The attribute of the written parsing result is written into the view component.

4. The interface rendering method based on iOS application according to claim 1, characterized in that: Also includes: Determine the dependent components corresponding to the view component; A constraint relationship is determined according to the view component and the dependent component, and the constraint relationship is written into the view component.

5. The interface rendering method based on iOS application according to claim 1, characterized in that: Also includes: Reading the attribute value corresponding to the attribute definition of the bottom page instance of the root view stack from the configuration file; The attribute definition of the bottom page instance of the root view stack is assigned according to the attribute value.

6. An interface rendering device based on iOS application, characterized in that: include: A virtual tree generation module is used to obtain the corresponding root view stack bottom page instance in response to the page creation demand, and parse the page subview corresponding to the root view stack bottom page instance to generate a virtual tree; A view instance generation module, used for mapping the virtual tree to a view component to create a sub-view instance, and generating a view instance according to the sub-view instance and the bottom page instance of the root view stack; A method implementation module, used to search for a corresponding method implementation from a configuration file according to a method definition of the bottom page instance of the root view stack; A binding writing module, used for binding a method responder corresponding to the method implementation with the method implementation, and writing the bound method implementation into the method definition; The iOS application-based interface rendering device is also specifically used for: Register the class corresponding to the iOS application, and add the method definition and the property definition of the bottom page instance of the root view stack to the class; Generate page data based on the class with added methods and attributes; Generate the bottom page instance of the root view stack according to the configuration file and the page data.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the interface rendering method based on iOS application described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the iOS application-based interface rendering method described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Web application interface generation system and method

    CN106528129A

  • Page rendering method and device

    CN111158818A