CN114020358B - Interface rendering method and device based on iOS application - Google Patents
Interface rendering method and device based on iOS application Download PDFInfo
- Publication number
- CN114020358B CN114020358B CN202111312693.4A CN202111312693A CN114020358B CN 114020358 B CN114020358 B CN 114020358B CN 202111312693 A CN202111312693 A CN 202111312693A CN 114020358 B CN114020358 B CN 114020358B
- Authority
- CN
- China
- Prior art keywords
- view
- instance
- page
- root
- configuration file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 177
- 238000009877 rendering Methods 0.000 title claims abstract description 88
- 238000013507 mapping Methods 0.000 claims abstract description 9
- 238000004590 computer program Methods 0.000 claims description 16
- 238000013499 data model Methods 0.000 claims description 14
- 230000001419 dependent effect Effects 0.000 claims description 8
- 230000004044 response Effects 0.000 claims description 5
- 238000011161 development Methods 0.000 abstract description 48
- 230000006870 function Effects 0.000 description 18
- 238000004458 analytical method Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 8
- 238000012545 processing Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 5
- 239000008186 active pharmaceutical agent Substances 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 241000220225 Malus Species 0.000 description 2
- 235000021016 apples Nutrition 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 101150027734 cript gene Proteins 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000010438 heat treatment Methods 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an interface rendering method and device based on iOS application, belongs to the technical field of cloud computing, and can be applied to the financial field or other fields. The interface rendering method based on the iOS application comprises the steps of responding to page creation requirements to obtain a corresponding root view stack bottom page instance, analyzing page sub-views corresponding to the root view stack bottom page instance to generate a virtual tree, mapping the virtual tree onto a view component to create the sub-view instance, generating the view instance according to the sub-view instance and the root view stack bottom page instance, searching for a corresponding method implementation from a configuration file according to a method definition of the root view stack bottom page instance, binding a method responder corresponding to the method implementation with the method implementation, and writing the bound method implementation into the method definition. The invention can meet the requirement of application dynamic property, improve page rendering performance, improve development efficiency and avoid hardware call restriction.
Description
Technical Field
The invention relates to the technical field of cloud computing, in particular to an interface rendering method and device based on iOS application.
Background
With the rapid development of computer technology and the popularization of various mobile devices, various user demands are fed back and realized through a software application with rich functions. However, the user needs are changing, and in order to provide better and faster software services to meet the changeable actual needs of the user, the application program development needs to update the version frequently to realize new needs. Because of the influence of native development and Objective-C language characteristics, the development period of the iOS application is relatively long, and the update iteration of the version cannot keep up with the change of the service, so how to reduce the development threshold and improve the application development efficiency becomes a problem to be solved urgently. The following techniques are typically used in the current application development process to address such issues:
Story Board is a new technology introduced by apples in iOS5, and is an interface development mode which apples always recommend to use. The tool is integrated in an IDE tool Xcode developed by apple company, is a visual interface editing tool, and has the advantage of being obtained by using XML description as a bottom layer. The method has the defects of poor dynamic performance and rendering performance, poor reusability and poor performance in team collaborative development.
Reactivative is a reactivative-based Javascript framework open in FaceBook 2015, and aims to develop mobile phone end applications efficiently by Javas cript. REACTNATIVE supports cross-end development, but the native platform cannot be completely shielded, the code writing is simple, and the dynamic property is strong. The disadvantage is that the page rendering performance is poor (this disadvantage is caused by its underlying rendering logic) and the stability is not high.
Componentkit is a frame of the development of the iOS native UI based on the React idea, which is pushed out by FaceBook. Comp onentKit create an interface using a functional and declarative (declarative) approach, using a form of unidirectional data stream to map from a immutable model to an immutable component to determine how a view is displayed. ComponentKit performs well in rendering and can be regarded as REACTNATIVE of a native version, and has the defects that developers need to be familiar with ObjC ++, the development threshold is high, the development efficiency is low, and the support on complex interface logic is poor.
The hybrid application comprises a hybrid architecture of part H5 and part Native, realizes the dynamization by defining the extension (Bridge) of Native based on the dynamism of H5, and is characterized in that the rendering of an interface is completed by HTML and CSS, and the bottom logic is realized by Native code bridging, and has the disadvantages of poor performance, strong dependence on a network and poor user experience.
The prior art has the following disadvantages in terms of improving the application development efficiency and reducing the development threshold:
1. Application dynamics and rendering performance cannot be balanced. Often, good dynamic performance of the application results in poor rendering performance. Prior art attempts have been made to dynamically update APP, such as using JSPatch for purely native development heating updates, or using Html5 for hybrid development, etc. JSPatch is disabled by the iOS platform and cannot pass the audit of the iOS platform, while Html5 has higher network requirements and poor rendering capability for page contents.
2. The development efficiency of the application and the user experience of the application cannot be balanced. In practical development, non-native technology is often used for developing an application program to improve development efficiency, but the non-native technology cannot fully realize page effects supported by native technology.
3. Mobile-side hardware invocation limitations there are significant limitations in experience and performance due to limitations of non-native technology itself, such as the inability of Hybrid mobile applications to directly access device hardware and offline storage.
Disclosure of Invention
The main purpose of the embodiment of the invention is to provide an interface rendering method and device based on iOS application, so as to meet the requirement of application dynamics, improve page rendering performance, improve development efficiency and avoid hardware call limitation.
In order to achieve the above object, an embodiment of the present invention provides an interface rendering method based on iOS application, including:
responding to the page creation requirement to obtain a corresponding root view stack bottom page instance, and analyzing a page sub-view corresponding to the root view stack bottom page instance to generate a virtual tree;
mapping the virtual tree onto the view component to create a child view instance, and generating a view instance according to the child view instance and the root view stack bottom page instance;
Searching for a corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance;
binding the method respondents corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
The embodiment of the invention also provides an interface rendering device based on the iOS application, which comprises:
The virtual tree generation module is used for responding to the page creation requirement to acquire a corresponding root view stack bottom page instance, analyzing a page sub-view corresponding to the root view stack bottom page instance and generating a virtual tree;
The view instance generation module is used for mapping the virtual tree onto the view component to create a child view instance, and generating a view instance according to the child view instance and the root view stack bottom page instance;
the method implementation module is used for searching the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance;
And the binding writing module is used for binding a method responder corresponding to the method realization with the method realization and writing the bound method realization into the method definition.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor realizes the steps of the interface rendering method based on the iOS application when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the iOS application-based interface rendering method.
According to the interface rendering method and device based on the iOS application, corresponding root view stack bottom page instances are obtained in response to page creation requirements to generate virtual trees, then the virtual trees are mapped to view components to create sub-view instances, view instances are generated according to the sub-view instances and the root view stack bottom page instances, then corresponding method implementations are searched from configuration files according to method definitions of the root view stack bottom page instances so that corresponding method respondents and the method implementations are bound, and then the method implementations are written into the method definitions, so that the requirements of application dynamics can be met, page rendering performance is improved, development efficiency is improved, and hardware call limitations are avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an interface rendering method based on an iOS application in an embodiment of the invention;
FIG. 2 is a flow chart of an interface rendering method based on an iOS application in another embodiment of the invention;
FIG. 3 is a flow chart of an interface rendering method based on an iOS application in yet another embodiment of the invention;
FIG. 4 is a flow chart of the create view component in an embodiment of the invention;
FIG. 5 is a flow chart of writing parsing results to a view component in an embodiment of the invention;
FIG. 6 is a flowchart of an example of generating a root view bottom page in an embodiment of the invention;
FIG. 7 is a schematic diagram of an iOS application-based interface rendering apparatus in an embodiment of the invention;
FIG. 8 is a block diagram illustrating an architecture of an iOS application-based interface rendering apparatus in accordance with another embodiment of the present invention;
FIG. 9 is a functional flow diagram of the module of FIG. 8;
Fig. 10 is a block diagram of a computer device in an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Those skilled in the art will appreciate that embodiments of the invention may be implemented as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of entirely hardware, entirely software (including firmware, resident software, micro-code, etc.) or in a combination of hardware and software.
The key terms mentioned in the present invention are defined as follows:
Objective-C language, the main development language of iOS native APP, which is extended by C language and Smalltalk, is a superset of C language, and the biggest difference is that OC is object-oriented. The ecology of the mobile internet brings about the rise of the Objective-C language.
The Objective-C language is a dynamic language that handles many static languages that do during compilation and linking periods when they are put into runtime. For Objective-C, the runtime system acts like an operating system in that it allows all work to run normally. Run times are basically written in C language and assembly language, such that the C language has object oriented capabilities. In run time, objects can be represented by structures in the C language, while methods can be implemented with C functions, with some additional features. These structures and functions, once encapsulated by runtime functions, enable object-oriented programming of the OC.
Storyboard integrated functions in IDE tool Xcode are visual interface editing tools, and the bottom layer uses XML description.
Native, the invention refers to App development by using development language, development class library and development tool related to iOS development.
The dynamic performance is a characteristic that the terminal can be executed in a starting state in the background, the characteristic can reduce the labor cost and the time cost of a terminal release version, and a user can quickly acquire the service of the latest version, so that the terminal release version is an important characteristic in the mobile Internet age.
Block is a C language expansion function that is introduced by iOS 4. Block is an anonymous function with an automatic variable (i.e., local variable) value, and as the name implies, is a function without a name with an automatic variable (i.e., local variable) value. Block is widely used in iOS development.
In view of the fact that the prior art cannot balance the application dynamic property and rendering performance, cannot balance the development efficiency of the application and the user experience of the application, and has hardware call limitation, the embodiment of the invention provides an interface rendering method based on the iOS application, which uses a configuration file with a specific rule to analyze the content of the configuration file during the running of an application program, and uses the runtime characteristic of iOS development to interpret and render pages corresponding to the configuration file so as to bring high-efficiency page rendering. The configuration file adopts a JSON data format, and the JSON data format is a lightweight data exchange text format which is completely independent of language, so that the JSON becomes an ideal data exchange language, is easy to read and write by people, and is easy to analyze and generate by machines. By combining the characteristic that the JSON data format is easy to write and the runtime characteristic of the iOS native development, the following technical problems can be solved:
1. Meeting the requirements of application dynamics. The method comprises the steps of using a configuration file as the description of an application page, presenting a complete application page by matching the explanation of the configuration file with a corresponding page rendering rule, and dynamically updating the application content by dynamically updating the configuration file so as to meet the requirement of the application program on the dynamics.
2. And the page rendering performance is improved. By utilizing the iOS runtime characteristic, the rendering of the page is actually realized by a rendering framework of the iOS system, and the rendering performance is effectively ensured.
3. And (5) code multiplexing. The portable modifiable configuration file has a unified rendering result under a unified interpretation method, and the configuration file can be reused, so that repeated coding is avoided.
4. Based on the iOS native, the native hardware call restriction is avoided. The iOS native development can directly call the hardware device which the system is allowed to access to and acquire relevant input data.
5. The development threshold is lowered, a user does not know OC language and iOS development, and the required app can be obtained only through configuration files.
The invention introduces the configuration file, can obtain a complete application program through analysis and rendering of the rendering engine without writing any original development code, and is described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of an iOS application-based interface rendering method in an embodiment of the present invention. FIG. 2 is a flow chart of an interface rendering method based on an iOS application in another embodiment of the invention. As shown in fig. 1 and 2, the iOS application-based interface rendering method includes:
S101, responding to page creation requirements, obtaining a corresponding root view stack bottom page instance, and analyzing page sub-views corresponding to the root view stack bottom page instance to generate a virtual tree.
In specific implementation, an application program page defined in a configuration file can be registered first, then a corresponding root view stack bottom page instance is obtained from a block in response to a page creation requirement, and a virtual tree is generated according to a page sub-view corresponding to the root view stack bottom page instance by analyzing the configuration file.
The root view stack bottom page instance is generated through a root view configuration file. The root view is the bottom-most controller of the application view, and can be a navigation controller (Navigation Controller) or a selection controller (tabbar Controller). The controller is of a stack structure and provides a pop and push method for loading and disappearing of new pages.
FIG. 3 is a flow chart of an interface rendering method based on an iOS application in yet another embodiment of the invention. As shown in fig. 3, the setting of the configuration file includes:
1. The configuration file of the application is generated according to established rules using a configuration file editor writing or other tool. The configuration files include a global general configuration file, a root view file, a page registration file, individual page files, and the like. The configuration file editor can be selected by combining with the development habit of a developer or a custom configuration file editor can be developed to improve the writing efficiency of the configuration file.
2. The application loads the configuration file. And starting the application program and locally acquiring the configuration file from the server or the application program. When the configuration file is loaded, a designated loading mode is required to be set so that an engine can confirm the source of the configuration file, and a reasonable loading strategy can be set so as to ensure the completeness of loading logic of the application program.
The configuration file can be selected as a resource file to be built in an application program according to the actual development situation, or the page can be modified in an active importing mode. Dynamic updating can be realized by matching the configuration files conforming to the rules with certain updating logic.
3. Analyzing and checking the configuration file, wherein the checking content comprises the following steps:
1) Integrity checks require that the application must have the configuration file complete.
2) And (3) verifying the validity, namely, checking the correctness of json data format of the configuration file, and missing fields and the like.
3) And checking the version, and detecting the version information of the configuration file to confirm the version as an available version.
FIG. 6 is a flowchart of an example of generating a root view bottom page in an embodiment of the invention. As shown in fig. 6, generating a root view bottom page instance includes:
s401, registering the class corresponding to the IOS application program, and adding method definition and attribute definition to the class.
In particular, the configuration file may be read to register classes corresponding to the IOS application and store the classes in the device memory, i.e., dynamically register the classes defined in the configuration file using IOS Runtime features, and add corresponding method definitions and attribute definitions to the classes.
And S402, generating page data according to the classes added by the method and the attribute.
S403, generating a root view stack bottom page instance according to the configuration file and the page data.
After the corresponding root view stack bottom page instance is obtained, the method further comprises the steps of reading attribute values corresponding to attribute definitions of the root view stack bottom page instance from the configuration file, and assigning the attribute definitions of the root view stack bottom page instance according to the attribute values, wherein assignment content can comprise page background color, navigation bar state, navigation bar title, entering animation and the like.
S102, mapping the virtual tree onto the view component to create a sub-view instance, and generating a view instance according to the sub-view instance and the root view stack bottom page instance.
The view component comprises an iOS system component or a custom component, the system component comprises UIView, UILabel, UIButton, UIImageView and the like, and the view instance is generated according to the child view instance and the root view stack bottom page instance by utilizing an iOS runtime mechanism.
And S103, searching for a corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance.
And S104, binding a method responder corresponding to the method implementation with the method implementation, and writing the bound method implementation into the method definition.
After the method implementation corresponding to the method respondent is bound with the method implementation, the page jump method can be processed by calling the method through a message sending mechanism in iOS runtime, and the method which can be arbitrarily and clearly defined with the receiver and the method implementation can also be processed.
After binding the method respondents corresponding to the method implementation with the method implementation, the layout information of the view can also be set through the following flow:
And traversing all dependency constraint information of the dependency component, determining constraint relation in the dependency constraint information according to the view component and the dependency component, and writing the constraint relation into the view component. The constraint relationship includes the position of the upper, lower, left, right, center points relative to the dependent components, as well as the width-to-height of the dependent components themselves or the aspect ratio relative to the dependent components.
The execution subject of the iOS application-based interface rendering method shown in fig. 1 may be an application program. As can be seen from the flow shown in fig. 1, the iOS application-based interface rendering method according to the embodiment of the present invention firstly obtains the corresponding root view bottom page instance in response to the page creation requirement to generate a virtual tree, then maps the virtual tree onto the view component to create a sub-view instance, generates the view instance according to the sub-view instance and the root view bottom page instance, and then searches the corresponding method implementation from the configuration file according to the method definition of the root view bottom page instance to bind the corresponding method responder and the method implementation, and then writes the method implementation into the method definition, thereby meeting the requirement of application dynamics, improving page rendering performance, improving development efficiency, and avoiding hardware call restriction.
FIG. 4 is a flow chart of the create view component in an embodiment of the invention. As shown in fig. 4, after S104 is performed, the iOS application-based interface rendering method further includes:
and 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.
In implementation, an interface (API) address corresponding to a page data model class may be read from a configuration file, a corresponding data model portion may be found from the configuration file, an attribute in the data model may be added to a corresponding registered class to register the data model class, and the data model class may be stored in memory.
S202, analyzing the data returned by the interface address, and writing the analysis result into the view component.
FIG. 5 is a flow chart of writing parsing results to a view component in an embodiment of the invention. As shown in fig. 5, writing the parsing result to the view component includes:
S301, writing the analysis result into the attribute of the instance corresponding to the page data model class.
S302, binding the attribute of the written analysis result with the view component according to the binding relation file.
In an embodiment, a binding relationship file may be obtained from the configuration file, and the attribute of the written analysis result and the attribute in the view component are bound according to the binding relationship file.
S303, writing the attribute of the writing analysis result into the attribute of the view component.
The page data also needs to be refreshed after S303 is performed.
The specific flow of the embodiment of the invention is as follows:
1. the class corresponding to the IOS application is registered, and method definitions and attribute definitions are added to the class.
2. Page data is generated from the classes subject to the method addition and attribute addition.
3. And generating a root view stack bottom page instance according to the configuration file and the page data.
4. And reading attribute values corresponding to the attribute definitions of the root view stack bottom page instance from the configuration file, and assigning the attribute definitions of the root view stack bottom page instance according to the attribute values.
5. And responding to the page creation requirement to acquire a corresponding root view stack bottom page instance, and analyzing a page sub-view corresponding to the root view stack bottom page instance to generate a virtual tree.
6. The virtual tree is mapped onto the view component to create sub-view instances, and view instances are generated from the sub-view instances and the root view bottom page instances.
7. And searching the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance.
8. Binding the method respondents corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
9. And determining a dependent component corresponding to the view component, determining a constraint relation according to the view component and the dependent component, and writing the constraint relation into the view component.
10. And registering the page data model class, generating a data request according to the instance corresponding to the page data model class, and sending the data request to the corresponding interface address.
11. Analyzing the data returned by the interface address, and writing the analysis result into the attribute of the instance corresponding to the page data model class.
12. And binding the attribute of the written analysis result with the view component according to the binding relation file.
13. And writing the attribute of the written analysis result into the view component.
In summary, the iOS application-based interface rendering method provided by the embodiment of the invention has the following beneficial effects:
(1) The application development threshold is reduced, and the development efficiency of the application is improved. And the JSON data is used as the data format of the configuration file, so that the development difficulty of developers is effectively reduced by utilizing the characteristic of easy writing and easy reading of the JSON data. After the non-developer is familiar with the writing rules of the configuration file, the non-developer can also write the page by editing the configuration file.
(2) The page rendering performance is improved while the dynamic performance is ensured. Updating the application configuration file in a form of issuing the configuration file by the server, explaining the updated configuration file, and calling the iOS system rendering framework to render pages. Prior art solutions sacrifice some of the system performance by loading H5 pages using a browser or implementing custom rendering policies. The invention utilizes the iOS runtime characteristic when carrying out page rendering, and completely uses the system characteristic to call the rendering framework of the system, thus ensuring the dynamic update of the application program and solving the problem of performance loss of the prior art scheme. ;
(3) The code reusability is improved, and the development cost is reduced. The complete configuration file of the system corresponds to the complete application program, and the single rule complete configuration file corresponds to the complete page, so that the reusability of the page only depends on the rendering engine described by the invention, and the configuration file of the rendering engine can be reused only by introducing the configuration file of the rendering engine. Through the continuous perfection and updating of the configuration files, the invention can expand the basic and advanced components of a whole set of application programs, and can be used as the strong productivity of the writing of the application programs;
(4) The prior rendering engine only performs page rendering through a rendering tree, and the push-push logic between pages and the complex processing logic of a page stack need to additionally add native logic codes, so that the invention can process jump logic between pages.
The data of the existing rendering engine can only be fixed data which is predefined, and the invention can request the latest data through a dynamic interface and perform modeling conversion and binding filling of view data, and can also interact with events of a user through dynamic processing. The user can complete the function development of the complete APP by only importing or issuing the configuration file without writing codes.
Based on the same inventive concept, the embodiment of the invention also provides an interface rendering device based on the iOS application, and because the principle of the device for solving the problem is similar to that of the interface rendering method based on the iOS application, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
Fig. 7 is a schematic diagram of an iOS application-based interface rendering apparatus in an embodiment of the present invention. Fig. 8 is a block diagram illustrating a structure of an iOS application-based interface rendering apparatus according to another embodiment of the present invention. Fig. 9 is a functional flow diagram of the module of fig. 8. As shown in fig. 7 to 9, the iOS application-based interface rendering apparatus includes:
The virtual tree generation module is used for responding to the page creation requirement to acquire a corresponding root view stack bottom page instance, analyzing a page sub-view corresponding to the root view stack bottom page instance and generating a virtual tree;
The view instance generation module is used for mapping the virtual tree onto the view component to create a child view instance, and generating a view instance according to the child view instance and the root view stack bottom page instance;
the method implementation module is used for searching the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance;
And the binding writing module is used for binding a method responder corresponding to the method realization with the method realization and writing the bound method realization into the method definition.
As shown in fig. 8 to 9, in practical application, the iOS application-based interface rendering apparatus includes:
1. and the configuration file generation module is used for writing configuration files required by the rendering engine. The rendering engine generates the complete application program through the configuration file. The configuration file type is json file, which comprises:
1) The global theme definition file is mainly used for configuring the overall style of the application program, and specifically comprises basic styles of essential components of the application program such as theme colors, navigation bar styles, status bar styles and the like.
2) The root view controller file is mainly used for determining the type of the root view of the application program, and comprises a general default style, a top navigation style (UINavigationController), a bottom navigation style (UITabBarController) and the like.
3) Page files, each page of the application program corresponds to a page configuration file, and the file mainly comprises:
a) Basic configuration information of the page, such as unique identification, name, type, etc. of the page.
B) Virtual tree structure of sub-views in a page. The page is formed by combining a plurality of controls in a specific hierarchical structure, and the virtual tree structure of the page records the hierarchical structure of all the controls of the page.
C) Layout constraint information for the child view. The hierarchy of controls on a page forms a definite dependency relationship, each control has its own dependent view, this view being referred to as the parent view with respect to the control, and the control being referred to as the child view with respect to the parent view. The layout constraint information of the sub-view is used for determining the position information of each control on the page so as to facilitate page layout.
D) Data binding relationship of pages and child views. The page and each sub-view on the page are used for bearing certain service information, the data binding relationship is determined, namely the service data borne by the sub-view is determined, and the assignment of view presentation content is facilitated through the bound data identification.
E) Event processing logic for the page and sub-views. The pages and sub-views on the pages bear certain user interaction logic that bears individual user behavior events. By defining event handling logic, user interaction is accomplished in the program through the triggering of these events.
4) The registration file is mainly used for storing registration information of each page of the application program so that the rendering engine can quickly search the corresponding page information.
2. And a dynamic code generation module. Run time is a set of bottom pure C language APIs, and OC codes are finally converted into run time codes by a compiler, and the function calling mode is determined by a message mechanism, which is also the basis for OC as a dynamic language. The dynamic code generation module dynamically generates classes defined in the registration files by utilizing the iOS Runtime characteristic and utilizing the run time, adds attributes, methods and events required in the classes, dynamically generates the classes required by page rendering in the execution process of the application program, does not have the resource files actually corresponding to the classes but are stored in the memory, and generates instance objects of the classes when required, wherein the instance objects follow the memory management rules of the iOS system.
3. And a registration module. A "page instance block code block" for the corresponding page is generated from page registration data defined in the registration file. A block code block is an anonymous function with an automatic variable (i.e., local variable) value. After the page instance block code block is registered and generated, each time the page needs to be displayed, the page instance is generated by calling the block code block corresponding to the page.
4. The rendering module comprises a virtual tree generating module and a view instance generating module and is used for analyzing the page file, and the flow is as follows:
1) And carrying out basic configuration of the page, and assigning basic information of the page in the configuration file to the page instance.
2) And resolving the child view description in the page configuration to generate a virtual view tree.
3) And according to the configuration file and the virtual view tree, the sub views are loaded on the page by traversing the view tree.
4) And adding position constraint information and width and height information to the sub-view through layout description in the configuration file, and completely rendering the page.
5. The data binding module comprises a method realization module and a binding writing module, and has the following two functions:
1) And carrying out corresponding binding on the data binding rules agreed by each view in the page configuration file and the corresponding attributes in the generated page instance.
2) And carrying out data request by using the service end API address agreed in the configuration file, carrying out data analysis on the request result, and carrying out data filling on each sub view according to the analysis result and the data rule agreed in the configuration file.
6. Event processing module:
1) Event processing is achieved by using the event reflection mechanism of the iOS application development language, the Objective-C language. The iOS system Foundation framework provides some method-reflected APIs for developers, through which operations such as converting a character string into SEL (class member method pointer, but different from function pointer in C language, function pointer directly holds address of method, but SEL is only method number) can be performed. Because of the dynamics of the OC language, these operations all occur at runtime, which can be controlled even by parameters passed back from the server by selecting at runtime to create a specified instance and dynamically selecting which method to invoke. Thus, using the iOS messaging mechanism, the Target and IMP (a function pointer, holding the address of the method) of the event are committed, and then the method handling logic committed in advance is invoked.
2) Event processing is performed through routing. The invention comprises a self-defined page route component which can create a corresponding route for each page. And carrying out event processing such as pushing, pushing and jumping among pages through route information agreed by the route components and the pages. The routing component can also conduct inter-page data transfer upon page jumps.
In summary, the iOS application-based interface rendering device of the embodiment of the invention firstly responds to the page creation requirement to obtain the corresponding root view stack bottom page instance to generate the virtual tree, then maps the virtual tree to the view component to create the sub-view instance, generates the view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance to write the method implementation into the method definition after binding the corresponding method responder and the method implementation, thereby meeting the requirement of application dynamics, improving page rendering performance, improving development efficiency and avoiding hardware call limitation.
The embodiment of the invention also provides a specific implementation mode of the computer equipment, which can realize all the steps in the interface rendering method based on the iOS application in the embodiment. Fig. 10 is a block diagram of a computer device according to an embodiment of the present invention, and referring to fig. 10, the computer device specifically includes:
A processor (processor) 1001 and a memory (memory) 1002.
The processor 1001 is configured to invoke a computer program in the memory 1002, where the processor executes the computer program to implement all the steps in the iOS application-based interface rendering method in the above embodiment, for example, the processor executes the computer program to implement the following steps:
responding to the page creation requirement to obtain a corresponding root view stack bottom page instance, and analyzing a page sub-view corresponding to the root view stack bottom page instance to generate a virtual tree;
mapping the virtual tree onto the view component to create a child view instance, and generating a view instance according to the child view instance and the root view stack bottom page instance;
Searching for a corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance;
binding the method respondents corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
In summary, the computer device of the embodiment of the invention firstly responds to the page creation requirement to obtain the corresponding root view stack bottom page instance to generate the virtual tree, then maps the virtual tree to the view component to create the sub-view instance, generates the view instance according to the sub-view instance and the root view stack bottom page instance, then searches the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance to write the method implementation into the method definition after binding the corresponding method responder and the method implementation, thereby meeting the requirement of application dynamics, improving page rendering performance, improving development efficiency and avoiding hardware call limitation.
The embodiment of the present invention further provides a computer readable storage medium capable of implementing all the steps in the iOS application-based interface rendering method in the above embodiment, where the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps in the iOS application-based interface rendering method in the above embodiment, for example, the processor implements the following steps when executing the computer program:
responding to the page creation requirement to obtain a corresponding root view stack bottom page instance, and analyzing a page sub-view corresponding to the root view stack bottom page instance to generate a virtual tree;
mapping the virtual tree onto the view component to create a child view instance, and generating a view instance according to the child view instance and the root view stack bottom page instance;
Searching for a corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance;
binding the method respondents corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
In summary, the computer readable storage medium of the embodiment of the invention firstly responds to the page creation requirement to obtain the corresponding root view stack bottom page instance to generate the virtual tree, then maps the virtual tree to the view component to create the sub-view instance, generates the view instance according to the sub-view instance and the root view stack bottom page instance, and then searches the corresponding method implementation from the configuration file according to the method definition of the root view stack bottom page instance to write the method implementation into the method definition after binding the corresponding method respondent and the method implementation, thereby meeting the requirement of application dynamics, improving page rendering performance, improving development efficiency and avoiding hardware call limitation.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.
Those of skill in the art will further appreciate that the various illustrative logical blocks (illustrative logical block), units, and steps described in connection with the embodiments of the invention may be implemented by electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software (interchangeability), various illustrative components described above (illustrative components), elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Those skilled in the art may implement the described functionality in varying ways for each particular application, but such implementation is not to be understood as beyond the scope of the embodiments of the present invention.
The various illustrative logical blocks, or units, or devices described in the embodiments of the invention may be implemented or performed with a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described. A general purpose processor may be a microprocessor, but in the alternative, the general purpose processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. In an example, a storage medium may be coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may reside in a user terminal. In the alternative, the processor and the storage medium may reside as distinct components in a user terminal.
In one or more exemplary designs, the above-described functions of embodiments of the present invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on a computer-readable medium or transmitted as one or more instructions or code on the computer-readable medium. Computer readable media includes both computer storage media and communication media that facilitate transfer of computer programs from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, such computer-readable media may include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that may be used to carry or store program code in the form of instructions or data structures and other data structures that may be read by a general or special purpose computer, or a general or special purpose processor. Further, any connection is properly termed a computer-readable medium, e.g., if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless such as infrared, radio, and microwave, and is also included in the definition of computer-readable medium. The disks (disks) and disks (disks) include compact disks, laser disks, optical disks, DVDs, floppy disks, and blu-ray discs where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included within the computer-readable media.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111312693.4A CN114020358B (en) | 2021-11-08 | 2021-11-08 | Interface rendering method and device based on iOS application |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111312693.4A CN114020358B (en) | 2021-11-08 | 2021-11-08 | Interface rendering method and device based on iOS application |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114020358A CN114020358A (en) | 2022-02-08 |
CN114020358B true CN114020358B (en) | 2025-01-28 |
Family
ID=80062142
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111312693.4A Active CN114020358B (en) | 2021-11-08 | 2021-11-08 | Interface rendering method and device based on iOS application |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114020358B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118672570A (en) * | 2023-03-20 | 2024-09-20 | 华为技术有限公司 | Self-adaptive application page display method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528129A (en) * | 2016-10-27 | 2017-03-22 | 南京南瑞继保电气有限公司 | Web application interface generation system and method |
CN111158818A (en) * | 2019-12-24 | 2020-05-15 | 中国建设银行股份有限公司 | Page rendering method and device |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10565293B2 (en) * | 2014-08-26 | 2020-02-18 | Adobe Inc. | Synchronizing DOM element references |
CN106569900B (en) * | 2016-10-28 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Applied program processing method and device |
CN111782209B (en) * | 2019-04-04 | 2024-07-12 | 阿里巴巴集团控股有限公司 | Page management method and device, electronic equipment and computer storage medium |
CN113312046A (en) * | 2020-02-26 | 2021-08-27 | 广州腾讯科技有限公司 | Sub-application page processing method and device and computer equipment |
CN113031949A (en) * | 2021-04-20 | 2021-06-25 | 深圳市活力天汇科技股份有限公司 | iOS-based text rendering engine, method, apparatus, device, and medium |
-
2021
- 2021-11-08 CN CN202111312693.4A patent/CN114020358B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528129A (en) * | 2016-10-27 | 2017-03-22 | 南京南瑞继保电气有限公司 | Web application interface generation system and method |
CN111158818A (en) * | 2019-12-24 | 2020-05-15 | 中国建设银行股份有限公司 | Page rendering method and device |
Also Published As
Publication number | Publication date |
---|---|
CN114020358A (en) | 2022-02-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Galloway et al. | Professional ASP. NET MVC 4 | |
US9471204B2 (en) | System and method for data-driven web page navigation control | |
WO2019233293A1 (en) | Method and apparatus for developing application program | |
US9524279B2 (en) | Help document animated visualization | |
CN110806863A (en) | Interface document generation method and device, electronic equipment and storage medium | |
KR101213832B1 (en) | Programmability for Data Binding | |
US20140053063A1 (en) | User interface control framework for stamping out controls using a declarative template | |
Cheng et al. | Build Mobile Apps with Ionic 4 and Firebase | |
CN115756449B (en) | A page multiplexing method, device, storage medium and electronic equipment | |
Freeman | Pro react 16 | |
CN116755669A (en) | Low code development method and tool based on DSL language operation model | |
CN114020358B (en) | Interface rendering method and device based on iOS application | |
Kotaru | „Angular for Material Design “ | |
bin Uzayr | Mastering CSS: A Beginner's Guide | |
US11010140B2 (en) | Integration of workflow and logical data objects using visual programming | |
CN111984300A (en) | Code copying method and device, electronic equipment and computer readable storage medium | |
Tesoriero et al. | Transformation architecture for multi-layered WebApp source code generation | |
Petukhova | Sitecore JavaScript Services Framework Comparison | |
CN116594676A (en) | Application packaging method, device, equipment and storage medium | |
Soni | Full stack angularJS for java developers: Build a full-featured web application from scratch using angularJS with spring RESTful | |
Strazzullo | Frameworkless Front-End Development | |
Zhao et al. | Research and achievement of UI patterns and presentation layer framework | |
US20200125476A1 (en) | Manipulation of complex variables in orchestration applications | |
CN113608726B (en) | Code generation method, device, electronic equipment and storage medium | |
US20240296350A1 (en) | Computed values for knowledge graph |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |