[go: up one dir, main page]

CN114020358A - Interface rendering method and device based on iOS application - Google Patents

Interface rendering method and device based on iOS application Download PDF

Info

Publication number
CN114020358A
CN114020358A CN202111312693.4A CN202111312693A CN114020358A CN 114020358 A CN114020358 A CN 114020358A CN 202111312693 A CN202111312693 A CN 202111312693A CN 114020358 A CN114020358 A CN 114020358A
Authority
CN
China
Prior art keywords
page
view
instance
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.)
Granted
Application number
CN202111312693.4A
Other languages
Chinese (zh)
Other versions
CN114020358B (en
Inventor
尚昱辰
杨新财
顾正之
王震
豆风雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202111312693.4A priority Critical patent/CN114020358B/en
Publication of CN114020358A publication Critical patent/CN114020358A/en
Application granted granted Critical
Publication of CN114020358B publication Critical patent/CN114020358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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

本发明提供一种基于iOS应用的界面渲染方法及装置,属于云计算技术领域,可应用于金融领域或其他领域。该基于iOS应用的界面渲染方法包括:响应页面创建需求获取对应的根视图栈底页面实例,解析根视图栈底页面实例对应的页面子视图生成虚拟树;将虚拟树映射到视图组件上以创建子视图实例,根据子视图实例和根视图栈底页面实例生成视图实例;根据根视图栈底页面实例的方法定义从配置文件中查找对应的方法实现;将方法实现对应的方法响应者与方法实现进行绑定,将绑定后的方法实现写入方法定义。本发明可以满足应用动态性的需求,提高页面渲染性能,提高开发效率,避免硬件调用限制。

Figure 202111312693

The invention provides an interface rendering method and device based on an iOS application, belonging to the technical field of cloud computing, and can be applied to the financial field or other fields. The iOS application-based interface rendering method includes: obtaining a corresponding root view stack bottom page instance in response to a page creation requirement, parsing 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 Subview instance, generate a view instance according to the subview instance and the bottom page instance of the root view stack; find the corresponding method implementation from the configuration file according to the method definition of the bottom page instance of the root view stack; find the corresponding method responder and method implementation of the method implementation Binding is performed, and the bound method implementation is written into the method definition. The invention can meet the requirements of application dynamics, improve page rendering performance, improve development efficiency, and avoid hardware call limitation.

Figure 202111312693

Description

Interface rendering method and device based on iOS application
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 software applications with rich functions. However, the user needs are changing, and in order to provide better and faster software services to meet the actual variable needs of users, the application program development needs to frequently perform version updating to realize new needs. Due to the influence of native development and Objective-C language characteristics, the iOS application development period is relatively long, and the update iteration of the version cannot keep up with the change of the business, so how to reduce the development threshold and improve the application development efficiency becomes a problem which needs to be solved urgently. The following techniques are commonly used in current application development processes to address such problems:
StoryBoard is a new technology introduced by apple in iOS5, and is an interface development mode which is recommended by apple all the time. The tool is integrated in an IDE tool Xcode developed by apple Inc., is a visual interface editing tool, is described by XML at the bottom layer, and has the advantages of WYSIWYG (what you see is what you get). The method has the defects of poor dynamic property and rendering performance, poor reusability and poor performance in team collaborative development.
ReactNative is a Javascript framework based on React that FaceBook 2015 opened source, aiming at efficiently developing mobile phone end application by using Javascript. The ReactNative supports cross-terminal development, but cannot completely shield a native platform, and has the advantages of simple code writing and strong dynamicity. The disadvantage is that the page rendering performance is poor (the disadvantage is caused by the rendering logic at the bottom layer) and the stability is not high.
ComponentKit is an iOS native UI development framework based on the fact idea, launched by FaceBook. The ComponentKit uses a functional and declarative (declarative) method to create an interface, and uses a form of unidirectional data stream to map from an immutable model to an immutable component to determine the display mode of a view. The ComponentKit has good rendering performance, 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 for complex interface logic is poor.
Hybrid application: the hybrid architecture of the part H5 and the part Native is based on the dynamic property of H5, and dynamic property is realized by defining the extension (Bridge) of the Native; the method is characterized in that the rendering of the interface is completed by HTML and CSS, and the bottom layer logic is realized by native code bridging; the disadvantages are poor performance, strong dependence on network and poor user experience.
In the aspects of improving the application development efficiency and reducing the development threshold, the prior art has the following defects:
1. application dynamics and rendering performance cannot be balanced. Often, the rendering performance is poor due to good dynamic performance of the application program. In the prior art, many attempts are made to dynamically update the APP, such as pure native development heating update by using JSPatch, hybrid development by using Html5, and the like. However, the JSPatch is forbidden by the iOS platform and cannot pass the audit of the iOS platform; and Html5 has high network requirements and poor rendering capability for page content.
2. The development efficiency of the application and the user experience of the application cannot be balanced. In actual development, non-native technologies are often used for developing application programs to improve development efficiency, but the non-native technologies cannot sufficiently achieve page effects supported by native.
3. And mobile terminal hardware calling limitation: due to the limitations of non-native technologies, such as the fact that Hybrid mobile applications cannot directly access device hardware and offline storage, there are significant limitations in experience and performance.
Disclosure of Invention
The embodiment of the invention mainly aims to provide an interface rendering method and device based on iOS application, so as to meet the requirements of application dynamics, improve page rendering performance, improve development efficiency and avoid hardware calling limitation.
In order to achieve the above object, an embodiment of the present invention provides an iOS application-based interface rendering method, including:
responding to a page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
mapping the virtual tree to a view component to create a sub-view example, and generating the view example according to the sub-view example and the page example at the bottom of the root view stack;
searching a corresponding method from a configuration file according to the method definition of the page example at the bottom of the stack of the root view;
binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
An embodiment of the present invention further provides an iOS application-based interface rendering apparatus, including:
the virtual tree generation module is used for responding to page creation requirements to obtain a corresponding root view stack bottom page example and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
the view instance generating module is used for mapping the virtual tree to the view component to create a sub-view instance and generating the view instance according to the sub-view instance and the page instance at the bottom of the root view stack;
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 example;
and the binding and 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 steps of the interface rendering method based on the iOS application are realized when the processor executes the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the interface rendering method based on the iOS application.
The interface rendering method and device based on the iOS application, provided by the embodiment of the invention, respond to a page creation requirement to obtain a corresponding root view stack bottom page example to generate a virtual tree, then map the virtual tree onto a view component to create a sub-view example, generate the view example according to the sub-view example and the root view stack bottom page example, and then search a corresponding method implementation from a configuration file according to the method definition of the root view stack bottom page example to bind a corresponding method responder and the method implementation and then write the method implementation into the method definition.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow chart of an interface rendering method based on an iOS application according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for interface rendering based on an iOS application in another embodiment of the present invention;
FIG. 3 is a flowchart of a method for interface rendering based on an iOS application according to another embodiment of the present invention;
FIG. 4 is a flow diagram of a create view component in an embodiment of the invention;
FIG. 5 is a flow diagram of writing the parsed result to the view component in an embodiment of the present invention;
FIG. 6 is a flowchart illustrating an example of generating a root view stack bottom page according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an interface rendering apparatus based on an iOS application according to an embodiment of the present invention;
FIG. 8 is a block diagram of an interface rendering apparatus based on an iOS application according to another embodiment of the present invention;
FIG. 9 is a functional flow diagram of the modules of FIG. 8;
fig. 10 is a block diagram of a computer device in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied 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 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 has brought about the rise of Objective-C language.
The Objective-C language is a dynamic language that puts much of the static language done during compile and link time into runtime for processing. For Objective-C, the runtime system behaves like an operating system: it allows all work to run normally. Runtime is basically written in C language and assembly language, so that C language has object-oriented capability. In Runtime, objects can be represented by structures in C language, and methods can be implemented by C functions, plus some additional features. After the structures and functions are packaged by runtime functions, object-oriented programming of the OC becomes possible.
Storyboard: the integrated functions in the IDE tool Xcode are visual interface editing tools, and the bottom layer uses XML description.
Primary production: the method utilizes iOS to develop related development language, development class library and development tool to develop App.
The dynamic property: the dynamic property refers to the property of being capable of being dynamically executed through background delivery, the property can reduce the labor cost and the time cost of a terminal release version, a user can also quickly acquire the latest version of service, and the dynamic property is an important property in the era of mobile internet.
block: block is a C language extension function introduced only by iOS 4. block is an anonymous function with an automatic variable (i.e., a local variable) value, which as its name implies is an unnamed function with an automatic variable (i.e., a local variable) value. blocks are widely used in iOS development.
In view of the fact that the application dynamics and rendering performance cannot be balanced, the development efficiency of the application and the user experience of the application cannot be balanced, and hardware calling limitations exist in the prior art, embodiments of the present invention provide an iOS application-based interface rendering method, where a configuration file of a specific rule is used to analyze the content of the configuration file during the running of an application program, and the running characteristics of the iOS development are used to interpret and render a page corresponding to the configuration file, thereby providing efficient page rendering. The configuration file adopts a JSON data format which is a lightweight data exchange text format completely independent of languages, and the characteristics make JSON become an ideal data exchange language, so that the JSON is easy to read and write by people and is easy to analyze and generate by a machine. By combining the characteristics of easy writing of JSON data format and the runtime characteristics of iOS native development, the following technical problems can be solved:
1. and the requirement of application dynamics is met. Using the configuration file as the description of the application page, and presenting the complete application page by matching the explanation of the configuration file with the corresponding page rendering rule; the dynamic update of the application content is realized through the dynamic update of the configuration file so as to meet the requirement of the application program on the dynamic property.
2. And the page rendering performance is improved. By utilizing the iOS running characteristic, the rendering of the page is actually realized by the rendering framework of the iOS system, and the rendering performance is effectively guaranteed.
3. And (4) coding and multiplexing. The configuration file which can be transplanted and modified has a uniform rendering result under a uniform interpretation method, and the configuration file can be repeatedly used, so that repeated coding is avoided.
4. Native hardware call restrictions are avoided based on iOS native. The iOS native development can directly call the hardware equipment which the system allows to access, and acquire the related input data.
5. The development threshold is lowered, and a user can obtain the required app only through the configuration file without knowing the development of the OC language and the iOS.
The invention introduces the configuration file, can obtain a complete application program through the analysis and the rendering of the rendering engine without writing any native development code, and the invention is explained in detail by combining the attached 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 flowchart of an iOS application based interface rendering method according to another embodiment of the present invention. As shown in fig. 1 and 2, the interface rendering method based on the iOS application includes:
s101: and responding to the page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree.
In specific implementation, an application page defined in a configuration file may be registered first, then a corresponding root view stack bottom page instance is obtained from the block in response to a page creation requirement, and a virtual tree is generated by analyzing a page sub-view corresponding to the root view stack bottom page instance according to the configuration file.
And generating a page example at the bottom of the root view stack through the root view configuration file. The root view is a Controller at the bottom layer of the application view, and can be a Navigation Controller (Navigation Controller) or a tab Controller (tab Controller). The controller is of a stack structure and provides a method for popping and pushing a stack for loading and disappearing of a new page.
Fig. 3 is a flowchart of an iOS application based interface rendering method according to still another embodiment of the present invention. As shown in fig. 3, the setting of the configuration file includes:
1. a configuration file for the application is generated using a configuration file editor writing or other tool according to established rules. The configuration files comprise a global general configuration file, a root view file, a page registration file, each page file and the like. The configuration file editor can be selected by a developer according to the development habit of the developer, or a self-defined configuration file editor is developed to improve the writing efficiency of the configuration file.
2. The application loads the configuration file. The application is started and the configuration file is obtained locally from the server or the application. When the configuration file is loaded, a specified loading mode needs to be set so that the engine can confirm the source of the configuration file, and a reasonable loading strategy can also be set so as to ensure the completeness of the loading logic of the application program.
The configuration file can be selected as a resource file to be built in the application program by combining with the actual development condition, or the page can be modified in an active import mode. Dynamic update can be realized only by matching the configuration files meeting the rules with certain update logic.
3. Analyzing and checking the configuration file, wherein the checking content comprises the following steps:
1) integrity check requires that the application must have the configuration file to be complete.
2) And (4) validity check, correctness of json data format of the configuration file, no field missing and the like.
3) And checking the version, namely detecting the version information of the configuration file and confirming the version information as an available version.
FIG. 6 is a flowchart illustrating an example of generating a root view stack bottom page according to an embodiment of the present invention. As shown in fig. 6, generating an instance of the stack bottom page of the root view includes:
s401: registering a class corresponding to the IOS application program, and adding method definition and attribute definition to the class.
In specific implementation, the configuration file may be read to register classes corresponding to the IOS application program, and the classes are stored in the device memory: and by utilizing the iOS Runtime characteristic, dynamically registering the class defined in the configuration file by using Runtime, and adding corresponding method definition and attribute definition to the class.
S402: and generating page data according to the classes subjected to the method addition and the attribute addition.
S403: and generating a stack bottom page example of the root view according to the configuration file and the page data.
After acquiring the corresponding root view stack bottom page instance, the method further comprises the following steps: reading an attribute value corresponding to the attribute definition of the page instance at the bottom of the stack of the root view from the configuration file; and assigning the attribute definition of the page example at the bottom of the stack of the root view according to the attribute value, wherein the assignment content can comprise page background color, navigation bar state, navigation bar title, entry animation and the like.
S102: and mapping the virtual tree onto the view component to create a sub-view instance, and generating the view instance according to the sub-view instance and the page instance at the bottom of the root view stack.
The view component comprises an iOS system component or a self-defined component, the system component comprises UIView, UILabel, UIButton, UIImageView and the like, and the view instance is generated according to the sub-view instance and the root view stack bottom page instance by utilizing an iOS runtime mechanism.
S103: and searching a corresponding method from the configuration file according to the method definition of the page example at the bottom of the stack of the root view.
S104: binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
After a method responder corresponding to the method realization is bound with the method realization, a method can be called to process a page jump method through a message sending mechanism in the iOS runtime, and any method clearly defining a receiver and the method realization can be processed.
After binding the method responder corresponding to the method implementation with the method implementation, the layout information of the view can be set through the following procedures:
searching layout information data of the corresponding component in the configuration file, and determining a dependent component corresponding to the view component from the layout information data; and traversing all the dependency constraint information of the dependency component, determining the 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 relationships include the location of the top, bottom, left, right center points relative to the dependent component, as well as the aspect ratio of the dependent component itself or relative to the dependent component.
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 process shown in fig. 1, the interface rendering method based on the iOS application according to the embodiment of the present invention first responds to a page creation requirement to obtain a corresponding root view stack bottom page instance to generate a virtual tree, then maps the virtual tree onto a 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 for a corresponding method implementation from a configuration file according to a method definition of the root view stack bottom page instance to bind a corresponding method responder to the method implementation and then writes the method implementation into the method definition, which can meet the requirement of application dynamics, improve page rendering performance, improve development efficiency, and avoid hardware call limitation.
FIG. 4 is a flow diagram of the create view component in an embodiment of the invention. As shown in fig. 4, after S104 is executed, the method for rendering an interface based on an iOS application further includes:
s201: 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.
In specific implementation, an interface (API) address corresponding to the page data model class may be read from the configuration file, a corresponding data model portion may be found from the configuration file, an attribute in the data model is added to a corresponding registered class to register the data model class, and the data model class is stored in the memory.
S202: and analyzing the data returned by the interface address, and writing an analysis result into the view component.
FIG. 5 is a flow diagram of writing the parsed result to the view component in an embodiment of the present invention. As shown in FIG. 5, writing the parsed result to the view component includes:
s301: and writing the analysis result into the attribute of the instance corresponding to the page data model class.
S302: and binding the attribute written in the analysis result with the view component according to the binding relation file.
In an embodiment, the binding relationship file may be obtained from the configuration file, and the attribute written in the analysis result and the attribute in the view component are subjected to data binding according to the binding relationship file.
S303: and writing the attribute written into the analysis result into the attribute of the view component.
The page data also needs to be refreshed after S303 is performed.
The specific process of the embodiment of the invention is as follows:
1. registering a class corresponding to the IOS application program, and adding method definition and attribute definition to the class.
2. And generating page data according to the classes subjected to the method addition and the attribute addition.
3. And generating a stack bottom page example of the root view according to the configuration file and the page data.
4. And reading an attribute value corresponding to the attribute definition of the root view stack bottom page instance from the configuration file, and assigning the attribute definition of the root view stack bottom page instance according to the attribute value.
5. And responding to the page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree.
6. And mapping the virtual tree onto the view component to create a sub-view instance, and generating the view instance according to the sub-view instance and the page instance at the bottom of the root view stack.
7. And searching a corresponding method from the configuration file according to the method definition of the page example at the bottom of the stack of the root view.
8. Binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
9. Determining a dependency component corresponding to the view component, determining a constraint relation according to the view component and the dependency component, and writing the constraint relation into the view component.
10. 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. And analyzing the data returned by the interface address, and writing an analysis result into the attribute of the instance corresponding to the page data model class.
12. And binding the attribute written in the analysis result with the view component according to the binding relation file.
13. And writing the attribute written into the analysis result into the view component.
In summary, the interface rendering method based on the iOS application provided by the embodiment of the present invention has the following beneficial effects:
(1) and the application development threshold is reduced, and the application development efficiency is improved. The JSON data is used as a data format of the configuration file, and the development difficulty of developers is effectively reduced by utilizing the characteristics of easy writing and easy reading of the JSON data. After the writing rules of the configuration file are familiar, non-developers can also write pages by editing the configuration file.
(2) The dynamic performance is guaranteed and the page rendering performance is improved. The application configuration file can be updated in a mode of issuing the configuration file by the server, the updated configuration file is interpreted, and an iOS system rendering framework is called to render the page. Prior art solutions sacrifice some system performance by using a browser to load the H5 page or implementing custom rendering policies. The invention utilizes the iOS running characteristic when rendering the page, and completely uses the system characteristic to call the rendering framework of the system, thereby not only ensuring the dynamic update of the application program, but also solving the problem of performance loss of the prior art. (ii) a
(3) The code reusability is improved, and the development cost is reduced. The configuration file with complete system corresponds to a complete application program, and the configuration file with complete rule corresponds to a complete page, so that the reusability of the page only depends on the rendering engine described by the invention, and the page can be reused by only introducing the configuration file of the rendering engine. By continuously improving and updating the configuration file, the invention can develop the basis and the high-level components of a whole set of application program as the strong productivity of the writing of the application program;
(4) the conventional rendering engine only performs page rendering through a rendering tree, and native logic codes are additionally added for push-push logic between pages and complex processing logic of a page stack, but the invention can process jump logic between pages.
The data of the existing rendering engine can only be predefined fixed data, but the invention can request the latest data through a dynamic interface and perform modeling conversion and binding and filling of view data, and can also interact with the events of the user through dynamic processing. A user can complete the function development of the complete APP only by importing or issuing the configuration file without compiling codes.
Based on the same inventive concept, the embodiment of the invention also provides an interface rendering device based on the iOS application, and as the principle of solving the problem of the device is similar to the interface rendering method based on the iOS application, the implementation of the device can refer to the implementation of the method, and repeated parts are not described again.
Fig. 7 is a schematic diagram of an iOS application-based interface rendering apparatus according to an embodiment of the present invention. Fig. 8 is a block diagram illustrating an interface rendering apparatus based on an iOS application according to another embodiment of the present invention. FIG. 9 is a functional flow diagram of the modules in 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 page creation requirements to obtain a corresponding root view stack bottom page example and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
the view instance generating module is used for mapping the virtual tree to the view component to create a sub-view instance and generating the view instance according to the sub-view instance and the page instance at the bottom of the root view stack;
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 example;
and the binding and 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 applications, the iOS application-based interface rendering apparatus includes:
1. and the configuration file generation module is used for writing the configuration file required by the rendering engine. And the rendering engine generates a complete application program through the configuration file. The configuration file type is a json file, and comprises the following steps:
1) the global theme definition file is mainly used for configuring the overall style of an application program, and specifically comprises the following steps: 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 the following steps: a general default style, a top navigation style (uinnavigationcontroller), a bottom navigation style (UITabBarController), etc.
3) The page file, 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 and type of the page.
b) A virtual tree structure of the sub-view in the 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 structures of all the controls of the page.
c) Layout constraint information of the child view. The hierarchical structure of the controls on the page forms a certain dependency relationship, each control has its own dependent view, which is called parent view relative to the control and child view relative 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) And (4) data binding relation of the page and the child view. The page and each sub-view on the page are used for bearing certain service information, the data binding relation is determined, namely the service data borne by the sub-views are determined, and the assignment of the view presentation content is facilitated through the bound data identification.
e) Event processing logic for pages and child views. The page and the sub-view on the page bear certain user interaction logic, and the interaction logic 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 register file is mainly used for storing the register 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. Runtime is a set of bottom pure C language API, OC codes are finally converted into Runtime codes by a compiler, a function calling mode is determined through a message mechanism, and the OC is also used as a basis of a dynamic language. The dynamic code generation module utilizes the iOS Runtime characteristic, uses Runtime to dynamically generate classes defined in the registration file, adds attributes, methods and events required in the classes, and dynamically generates classes required by page rendering in the execution process of the application program, wherein the classes do not actually correspond to resource files and are only stored in a memory, and instance objects of the classes are generated when needed, and the instance objects follow the memory management rules of the iOS system.
3. And registering the module. And generating a page instance block code block of the corresponding page through page registration data defined in the registration file. A block code block is an anonymous function with values of automatic variables (i.e. local variables). After the block code block of the page instance is registered and generated, when 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 process comprises the following steps:
1) and carrying out page basic configuration, and assigning basic information of the pages in the configuration file to the page example.
2) And analyzing the child view description in the page configuration to generate a virtual view tree.
3) And corresponding to the basic component according to the configuration file and the virtual view tree, and loading each sub-view to the page by traversing the view tree.
4) And adding position constraint information and width and height information to the sub-views through layout description in the configuration file, and completely rendering the page.
5. The data binding module comprises a method implementation module and a binding write-in module, and has the following two functions:
1) and correspondingly binding the data binding rule appointed by each view in the page configuration file with the corresponding attribute in the generated page instance.
2) And performing data request by using the API address of the server side appointed in the configuration file, performing data analysis on the request result, and performing data filling on each sub-view according to the analysis result and the data rule appointed in the configuration file.
6. An event processing module:
1) event processing is achieved by using an event reflection mechanism in the iOS application development language Objective-C language. The iOS system Foundation framework provides developers with some method-reflective APIs through which operations such as converting strings into SELs (pointers to class member methods, but unlike function pointers in the C language, function pointers directly hold addresses of methods, but SELs are only method numbers) can be performed. Due to the dynamic nature of the OC language, these operations all occur at runtime, where a specific instance can be selected to be created and which method to invoke dynamically, and these operations can even be controlled by parameters passed back by the server. Therefore, by using the message mechanism of the iOS, Target and IMP (a function pointer, which stores the address of the method) of the event are agreed, and then the method processing logic agreed in advance is called.
2) Event processing is performed through routing. The invention comprises a self-defined page routing component, and can create corresponding routes for each page. And event processing such as pushing, jumping and the like among the pages is carried out through the routing components and the routing information appointed by the pages. The routing component may also perform inter-page data transfers at page hops.
To sum up, the interface rendering apparatus based on the iOS application according to the embodiment of the present invention first responds to a page creation requirement to obtain a corresponding root view stack bottom page instance to generate a virtual tree, then maps the virtual tree onto a view component to create a sub-view instance, generates the view instance according to the sub-view instance and the root view stack bottom page instance, and then searches a corresponding method implementation from a configuration file according to a method definition of the root view stack bottom page instance to bind a corresponding method responder and the method implementation and then writes the method implementation into the method definition, which can meet the requirement of application dynamics, improve page rendering performance, improve development efficiency, and avoid hardware call limitation.
The embodiment of the present invention further provides a specific implementation manner of a computer device, which can implement all steps in the interface rendering method based on the iOS application in the foregoing embodiment. Fig. 10 is a block diagram of a computer device in an embodiment of the present invention, and referring to fig. 10, the computer device specifically includes the following:
a processor (processor)1001 and a memory (memory) 1002.
The processor 1001 is configured to call a computer program in the memory 1002, and when the processor executes the computer program, the processor implements all steps in the interface rendering method based on the iOS application in the foregoing embodiment, for example, when the processor executes the computer program, the processor implements the following steps:
responding to a page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
mapping the virtual tree to a view component to create a sub-view example, and generating the view example according to the sub-view example and the page example at the bottom of the root view stack;
searching a corresponding method from a configuration file according to the method definition of the page example at the bottom of the stack of the root view;
binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
To sum up, the computer device of the embodiment of the present invention first 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 onto 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 bind the corresponding method responder and the method implementation and then writes the method implementation into the method definition, which can meet the requirement of application dynamics, improve the page rendering performance, improve the development efficiency, and avoid the hardware call limitation.
An embodiment of the present invention further provides a computer-readable storage medium capable of implementing all steps in the interface rendering method based on the iOS application in the foregoing embodiment, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements all steps of the interface rendering method based on the iOS application in the foregoing embodiment, for example, when the processor executes the computer program, implements the following steps:
responding to a page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
mapping the virtual tree to a view component to create a sub-view example, and generating the view example according to the sub-view example and the page example at the bottom of the root view stack;
searching a corresponding method from a configuration file according to the method definition of the page example at the bottom of the stack of the root view;
binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
To sum up, the computer-readable storage medium of the embodiment of the present invention first 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 onto 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 bind the corresponding method responder and the method implementation and then writes the method implementation into the method definition, which can meet the requirement of application dynamics, improve the page rendering performance, improve the development efficiency, and avoid the hardware call limitation.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Those of skill in the art will further appreciate that the various illustrative logical blocks, units, and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate the interchangeability of hardware and software, various 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. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
The various illustrative logical blocks, or elements, or devices described in connection with the embodiments disclosed herein 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 herein. A general-purpose processor may be a microprocessor, but in the alternative, the 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. For example, a storage medium may be coupled to the processor such 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 be located in a user terminal. In the alternative, the processor and the storage medium may reside in different components in a user terminal.
In one or more exemplary designs, the functions described above in connection with the embodiments of the invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media that facilitate transfer of a computer program from one place to another. 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 can 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 which can be used to carry or store program code in the form of instructions or data structures and which can be read by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Additionally, any connection is properly termed a computer-readable medium, and, thus, is included 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 wirelessly, e.g., infrared, radio, and microwave. Such discs (disk) and disks (disc) include compact disks, laser disks, optical disks, DVDs, floppy disks and blu-ray disks where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included in the computer-readable medium.

Claims (10)

1. An interface rendering method based on iOS application is characterized by comprising the following steps:
responding to a page creation requirement to obtain a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example 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 page instance at the bottom of the root view stack;
searching a corresponding method from a configuration file according to the method definition of the root view stack bottom page example;
and binding a method responder corresponding to the method realization with the method realization, and writing the bound method realization into the method definition.
2. The iOS application-based interface rendering method according to claim 1, further comprising:
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;
and analyzing the data returned by the interface address, and writing an analysis result into the view component.
3. The iOS application-based interface rendering method of claim 2, wherein writing the parsing result to the view component comprises:
writing the analysis result into the attribute of the instance corresponding to the page data model class;
binding the attribute written in the analysis result with the view component according to the binding relation file;
and writing the attribute of the write analysis result into the view component.
4. The iOS application-based interface rendering method according to claim 1, further comprising:
determining a dependency component corresponding to the view component;
and determining a constraint relation according to the view component and the dependency component, and writing the constraint relation into the view component.
5. The iOS application-based interface rendering method according to claim 1, further comprising:
reading an attribute value corresponding to the attribute definition of the root view stack bottom page instance from the configuration file;
and assigning the attribute definition of the page instance at the bottom of the stack of the root view according to the attribute value.
6. The iOS application-based interface rendering method of claim 5, further comprising:
registering a class corresponding to the IOS application program, and adding the method definition and the attribute definition to the class.
7. The iOS application-based interface rendering method of claim 6, further comprising:
generating page data according to the classes subjected to method addition and attribute addition;
and generating a page example at the bottom of the stack of the root view according to the configuration file and the page data.
8. An iOS application-based interface rendering apparatus, comprising:
the virtual tree generation module is used for responding to a page creation requirement, acquiring a corresponding root view stack bottom page example, and analyzing a page sub-view corresponding to the root view stack bottom page example to generate a virtual tree;
the view instance generating module is used for mapping the virtual tree to a view component to create a sub-view instance and generating the view instance according to the sub-view instance and the page instance at the bottom of the root view stack;
the method realization module is used for searching the corresponding method realization from the configuration file according to the method definition of the root view stack bottom page example;
and the binding and 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.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, characterized in that the processor implements the steps of the iOS application based interface rendering method of any of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the iOS application based interface rendering method of any of claims 1 to 7.
CN202111312693.4A 2021-11-08 2021-11-08 Interface rendering method and device based on iOS application Active CN114020358B (en)

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 true CN114020358A (en) 2022-02-08
CN114020358B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024193215A1 (en) * 2023-03-20 2024-09-26 华为技术有限公司 Adaptive display method and device for application page

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160062963A1 (en) * 2014-08-26 2016-03-03 Adobe Systems Incorporated Synchronizing DOM Element References
CN106528129A (en) * 2016-10-27 2017-03-22 南京南瑞继保电气有限公司 Web application interface generation system and method
WO2018077085A1 (en) * 2016-10-28 2018-05-03 腾讯科技(深圳)有限公司 Application processing method, device and storage medium
CN111158818A (en) * 2019-12-24 2020-05-15 中国建设银行股份有限公司 Page rendering method and device
CN111782209A (en) * 2019-04-04 2020-10-16 阿里巴巴集团控股有限公司 Page management method and device, electronic equipment and computer storage medium
CN113031949A (en) * 2021-04-20 2021-06-25 深圳市活力天汇科技股份有限公司 iOS-based text rendering engine, method, apparatus, device, and medium
CN113312046A (en) * 2020-02-26 2021-08-27 广州腾讯科技有限公司 Sub-application page processing method and device and computer equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160062963A1 (en) * 2014-08-26 2016-03-03 Adobe Systems Incorporated Synchronizing DOM Element References
CN106528129A (en) * 2016-10-27 2017-03-22 南京南瑞继保电气有限公司 Web application interface generation system and method
WO2018077085A1 (en) * 2016-10-28 2018-05-03 腾讯科技(深圳)有限公司 Application processing method, device and storage medium
CN111782209A (en) * 2019-04-04 2020-10-16 阿里巴巴集团控股有限公司 Page management method and device, electronic equipment and computer storage medium
CN111158818A (en) * 2019-12-24 2020-05-15 中国建设银行股份有限公司 Page rendering method and device
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

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
KOSTAS KAPETANAKIS ET AL.: "Evaluation of techniques for web 3D graphics animation on portable devices", 《IEEE XPLORE》, 6 September 2012 (2012-09-06) *
施莹;: "构建原生的JavaScript单页Web应用的解决方案", 正德职业技术学院学报, no. 01, 15 December 2019 (2019-12-15) *
李思源: "短信服务平台多语言化前端设计与优化", 《万方数据库》, 17 May 2017 (2017-05-17) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024193215A1 (en) * 2023-03-20 2024-09-26 华为技术有限公司 Adaptive display method and device for application page

Also Published As

Publication number Publication date
CN114020358B (en) 2025-01-28

Similar Documents

Publication Publication Date Title
US9524279B2 (en) Help document animated visualization
US7610545B2 (en) Annotations for tracking provenance
TWI556170B (en) Projecting native application programming interfaces of an operating system into other programming languages (2)
US20190243665A1 (en) Application runtime configuration using design time artifacts
Cheng et al. Build Mobile Apps with Ionic 4 and Firebase
Kozlowski et al. Mastering Web Application Development with AngularJS.
Bertoli React Design Patterns and Best Practices
Snell et al. Microsoft Visual Studio 2012 Unleashed: Micro Visua Studi 2012 Unl_p2
CN116679912B (en) Code generation method, apparatus, device, storage medium, and computer program
Kotaru „Angular for Material Design “
CN116755669A (en) Low code development method and tool based on DSL language operation model
Khanna et al. Ionic: Hybrid Mobile App Development
CN114020358B (en) Interface rendering method and device based on iOS application
Roldán React Design Patterns and Best Practices: Design, build and deploy production-ready web applications using standard industry practices
Ribeiro Vue. js 3 Cookbook: Discover actionable solutions for building modern web apps with the latest Vue features and TypeScript
CN111984300A (en) Code copying method and device, electronic equipment and computer readable storage medium
CN119203963A (en) Business report generation method, device and electronic equipment
Shavin et al. Frontend Development Projects with Vue. js 3
Soni Full stack angularJS for java developers: Build a full-featured web application from scratch using angularJS with spring RESTful
Hindrikes et al. Xamarin. Forms Projects: Build multiplatform mobile apps and a game from scratch using C# and Visual Studio 2019
Duldulao ASP. NET Core and Vue. js: Build real-world, scalable, full-stack applications using Vue. js 3, TypeScript,. NET 5, and Azure
Strazzullo Frameworkless Front-End Development
CN114661341A (en) A method and device for acquiring code auxiliary information
Purushothaman Oracle ADF Real World Developer's Guide
Campesato Angular and Deep Learning Pocket Primer

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