Detailed Description
Interpretation of terms:
the uitapdesturerecognizers, uigedesturerecognizers, which are abstract classes, define all behaviors of basic gestures, such as uitapdesturerecognizers (click), uilongpressgedesturerecognizers (long press), uipangetdesturerecognizers (drag), uiswigedesturerecognizers (light sweep), uirotationgedesturerecognizers (rotate), and uincgesturerecognizers (pinch, for zoom).
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
The embodiment of the invention provides a page display method, a storage medium, an electronic device and a system, wherein a father type controller is used for allocating calling addresses of all page display functions to all sub type controllers according to the page display requirements, and then all the sub type controllers are directly used for performing page display work by means of all the page display functions, so that programs required by the page display work are simplified, the work efficiency of the page display work is improved, and the programming workload is reduced.
In order to achieve the technical effects, the general idea of the application is as follows:
a page display method comprises the following steps:
s1, creating a parent controller, wherein the parent controller is configured with a user-defined inheritance function and call addresses of various page display functions;
s2, acquiring a plurality of function type parameters, wherein the function type parameters are used for representing display function types required by page display;
s3, creating a plurality of sub-class controllers, wherein each sub-class controller corresponds to one function class parameter;
s4, the child controller inherits the calling address of the page display function corresponding to the function type parameter in the parent controller according to the function type parameters by using the custom inheritance function;
s5, storing the function type parameters into the corresponding subclass controller, wherein the function type parameters are also used for marking the creating function type corresponding to the subclass controller;
s6, acquiring a page display address needing to be subjected to page display;
and S7, acquiring the page display requirement data to be displayed, and performing page display work by utilizing various sub-controllers.
Example one
Referring to fig. 1, an embodiment of the present invention provides a page display method, including the following steps:
s1, creating a father controller, which is configured with a user-defined inheritance function and calling addresses of various page display functions;
s2, acquiring a plurality of function type parameters, wherein the function type parameters are used for representing display function types required by page display;
s3, creating a plurality of sub-class controllers, wherein each sub-class controller corresponds to one function class parameter;
s4, the child controller inherits the calling address of the page display function corresponding to the function type parameter in the parent controller according to the function type parameters by using the custom inheritance function;
s5, storing the function type parameters into the corresponding subclass controller, wherein the function type parameters are also used for marking the creating function type corresponding to the subclass controller;
s6, acquiring a page display address needing to be subjected to page display;
and S7, acquiring the page display requirement data to be displayed, and performing page display work by utilizing various sub-controllers.
It should be noted that the parent controller and the child controller belong to a parent-child mechanism, the custom inheritance function is a commonly used method for child inheritance to the parent, and the custom inheritance function can be a super function;
in advance, when a father type controller is established, the calling addresses of all page display functions are counted and stored in the father type controller, and all the page display functions are specifically the same as the existing page display functions, such as a font setting function, a page height setting function and a page background color setting function;
when a subclass controller needs to be created, setting a function type parameter according to the function which needs to be distributed to the subclass controller, marking the subclass controller by using the function type parameter for representing the function corresponding to the subclass controller, and then inheriting a page display function corresponding to the function type parameter by the subclass controller, wherein the specific inheritance method can be a super function;
and when the specific page is displayed, the page display method is consistent with the existing page display steps, the page display function calling step is optimized, the code of each page display function is not required to be written into a program, the corresponding page display function can be called only by using the subclass controller, and the page display work is performed based on the conventional page display operation.
According to the embodiment of the invention, a father controller is firstly created, the father controller is configured with a custom inheritance function, a plurality of son controllers are created according to the requirement of page display, the son controllers inherit the calling addresses of the page display functions corresponding to the function type parameters in the father controller according to the function type parameters by using the custom inheritance function according to the requirement of page display, and then page display work is directly performed by using the son controllers by means of the page display functions, so that programs required by the page display work are more simplified, the work efficiency of the page display work is improved, and the programming workload is reduced.
In the embodiment of the invention, firstly, in step S1, a parent controller is created, which is configured with a custom inheritance function;
next, in step S2, a plurality of function type parameters are preset, where the function type parameters are used to indicate a creation function type required when the page is displayed;
it should be noted that the function type parameter may be specifically a display function type required by page display, such as a background color, a page size, a page font, and the like of a page during display, that is, each function type parameter corresponds to a display function type of a page, and the custom inheritance function establishes a connection between each function type parameter and each page display function, when the custom inheritance function obtains the function type parameter, the custom inheritance function may obtain a call address of the page display function corresponding to the function type parameter according to the function type parameter, so as to perform inheritance work, and the subclass controller inherits the call address of the page display function of the parent controller;
the page display function specifically refers to a function for completing different page display tasks in the page display working process, such as setting work of page background color, page size, page font and other items during page display;
further, in step S3, a plurality of sub-class controllers are created, each sub-class controller corresponding to a function type parameter, that is, each sub-class controller actually corresponds to a page display function, and each sub-class controller corresponds to a page display function;
the method comprises the steps that a subclass controller is connected with a user-defined calling file, wherein two user-defined storage files are preset in the subclass controller, the user-defined storage files are used for storing function type parameters corresponding to the subclass controller, and the user-defined calling file is used for storing calling addresses of page display functions corresponding to the function type parameters corresponding to the subclass controller;
in step S4, the subclass controller inherits the call address of the page display function corresponding to the function type parameter in the parent class controller according to each function type parameter by using the custom inheritance function, and stores the inherited call address into a custom storage file preset in the corresponding subclass controller;
further, in step S5, the function type parameter is stored in the corresponding sub-class controller, and the function type parameter is further used to mark the created function type corresponding to the sub-class controller;
after the above steps are all completed, starting page display working steps S6 and S7, and acquiring a page display address needing page display;
acquiring page display requirement data to be displayed, and performing page display work by utilizing each subclass controller;
it should be noted that, when performing page display, the page display requirement data that needs to be performed on the page display and the page display address that needs to be performed on the page display should be acquired, and then page display work is performed by means of each sub-controller according to the page display requirement data.
The embodiment of the invention has the advantages that when the page display work is carried out, the page display method is consistent with the conventional page display means, and the page display method has the advantages that each page display function is used by means of each subclass controller, so that the workload of code compiling is reduced, the working efficiency is improved, and the risk of code compiling errors is reduced;
the embodiment of the invention actually makes a plurality of subclass controllers according to the requirements, one subclass controller corresponds to a function required by page display, so that when the page display is carried out, a large number of codes do not need to be input, the existing page display function does not need to be written repeatedly, when a certain page display function needs to be used, the corresponding subclass controller is directly called, the complexity of the program is reduced, and the workload during programming is reduced.
In the embodiment of the invention, the father controller is provided with a common interface, and each son controller inherits the calling address of the page display function corresponding to the function type parameter to the father controller by the aid of the common interface.
In the embodiment of the invention, the method further comprises the following steps:
a plurality of self-defined parameters are preset in the parent controller, each defined parameter at least corresponds to one page display function, and the self-defined parameters are used for storing corresponding data information when the page display functions are called;
and the child controller inherits the custom parameters corresponding to the page display functions corresponding to the functional type parameters in the parent controller according to the functional type parameters by utilizing the custom inheritance function.
In the embodiment of the invention, each subclass controller configuration is provided with a declaration file, and the declaration file is used for marking the legality of the subclass controller.
In the embodiment of the invention, before the page display work, the method further comprises the following steps:
and judging whether half-screen display work is needed, and if so, performing half-screen display when various sub-controllers are used for performing page display work.
In the embodiment of the present invention, acquiring a page display address to be page displayed specifically includes the following steps:
defining an address acquisition module which is independent of a parent controller and a child controller and is configured with a preset address acquisition function;
acquiring a page display address needing page display by using an address acquisition module;
the page display address is acquired by adopting the address acquisition module, the address acquisition module is mutually independent from the parent controller, and the address acquisition module is mutually independent from the child controller, namely, the address acquisition module is isolated and packaged, so that decoupling is facilitated during actual operation.
In the embodiment of the invention, after the page display work is carried out on the page display address by utilizing each sub-controller, the method further comprises the following steps:
adding a gesture operation function by using a gesture function;
in specific operation, the UITapGestureRecognizer is used for calling the alloc function and the init function to create a gesture bgTapGes, and the created bgTapGes is placed on a background layer of a page being displayed.
Based on the same inventive concept, the application also provides another embodiment of the page display method, which is detailed in embodiment two
Example two
As shown in fig. 2, a second embodiment of the present invention provides a page display method, including the following steps:
q1, creating a first unit, and configuring a custom inheritance function and call addresses of various page display functions;
q2, acquiring a plurality of function type parameters, wherein the function type parameters are used for representing display function types required by page display;
q3, creating a plurality of second units, wherein each second unit corresponds to one type of function type parameter;
q4, the second unit inherits the calling address of the page display function corresponding to the function type parameter in the first unit according to each function type parameter by using the custom inheritance function;
q5, storing the function type parameter into the corresponding second unit, wherein the function type parameter is also used for marking the creating function type corresponding to the second unit;
q6, acquiring a page display address needing page display;
and Q7, acquiring page display data to be displayed, and performing page display work by using each second unit.
According to the page display method and device, the first unit is created, the first unit is configured with the user-defined inheritance function, the plurality of second units are created according to the page display requirement, the first units are used for inheriting the calling addresses of the page display functions corresponding to the function type parameters in the first units according to the page display requirement, the second units use the user-defined inheritance function according to the function type parameters, and then page display work is directly performed by the second units through the page display functions, so that programs needed by the page display work are simplified, the work efficiency of the page display work is improved, and the programming workload is reduced.
In the embodiment of the present invention, first, in step Q1, a first unit is created, and configured with a custom inheritance function;
then in step Q2, presetting a plurality of function type parameters, where the function type parameters are used to indicate the creation function type required when the page is displayed;
it should be noted that the function type parameter may specifically be a display function type required for page display, such as a background color, a page size, a page font, and the like of a page during display, that is, each function type parameter corresponds to a display function type of a page, and the custom inheritance function establishes a relationship between each function type parameter and each page display function, and when the custom inheritance function obtains the function type parameter, the second unit inherits a call address of the page display function corresponding to the function type parameter in the first unit according to each function type parameter by using the custom inheritance function;
the page display function specifically refers to a function for completing different page display tasks in the page display working process, such as setting work of page background color, page size, page font and other items during page display;
further in step Q3, a plurality of second cells are created, each corresponding to a function type parameter, i.e. each second cell actually corresponds to a page display function, and one second cell corresponds to a page display function;
the second unit is preset with two user-defined storage files, the user-defined storage files are used for storing function type parameters corresponding to the second unit, and the user-defined calling files are used for storing calling addresses of page display functions corresponding to the function type parameters corresponding to the second unit;
therefore, in step Q4, the second unit inherits the call address of the page display function corresponding to the function type parameter in the first unit according to each function type parameter by using the custom inheritance function;
further in step Q5, storing the function type parameter in the corresponding second unit, wherein the function type parameter is also used for marking the creating function type corresponding to the second unit;
after the steps are completed, starting page display working steps Q6 and Q7 to obtain a page display address needing page display;
acquiring page display requirement data to be displayed, and performing page display work by using each second unit;
it should be noted that, when performing page display, the page display requirement data to be page displayed and the page display address to be page displayed should be acquired, and page display work is performed by each second unit according to the page display requirement data;
the embodiment of the invention has the advantages that when the page display work is carried out, the page display method is consistent with the conventional page display means, and the page display method has the advantages that each page display function is used by each second unit, so that the workload of code compiling is reduced, the working efficiency is improved, and the risk of code compiling errors is reduced;
the embodiment of the invention actually makes a plurality of second units according to the requirements, one second unit corresponds to a function required by page display, so that when the page display is carried out, a large number of codes do not need to be input, the existing page display function does not need to be written repeatedly, when a certain page display function needs to be used, the second unit corresponding to the certain page display function is directly called, the complexity of the program is reduced, and the workload during programming is reduced.
In the embodiment of the invention, the first unit is provided with a common interface, and each second unit inherits the calling address of the page display function corresponding to the function type parameter to the first unit by virtue of the common interface.
In the embodiment of the invention, the method further comprises the following steps:
the first unit is preset with a plurality of self-defined parameters and calling addresses of a plurality of page display functions, the respective defined parameters at least correspond to one page display function, and the self-defined parameters are used for storing corresponding data information when the page display functions are called;
and the second unit inherits the self-defined parameters corresponding to the page display functions corresponding to the functional type parameters in the first unit by utilizing the self-defined inheritance functions according to the functional type parameters.
In the embodiment of the invention, each second unit configuration is provided with a declaration file, and the declaration file is used for marking the legality of the second unit.
In the embodiment of the invention, before the page display work, the method further comprises the following steps:
and judging whether half-screen display work is needed, and if so, performing half-screen display when each second unit is utilized to perform page display work.
In the embodiment of the present invention, acquiring a page display address to be page displayed specifically includes the following steps:
defining an address acquisition module which is independent of the first unit and the second unit and is configured with a preset address acquisition function;
acquiring a page display address needing page display by using an address acquisition module;
the page display address is acquired by adopting the address acquisition module, the address acquisition module is mutually independent from the first unit, and the address acquisition module is mutually independent from the second unit, namely, the address acquisition module is isolated and packaged, so that decoupling is facilitated during actual operation.
In the embodiment of the present invention, after the page display operation is performed on the page display address by using each second unit, the method further includes the following steps:
adding a gesture operation function by using a gesture function;
in specific operation, the UITapGestureRecognizer is used for calling the alloc function and the init function to create a gesture bgTapGes, and the created bgTapGes is placed on a background layer of a page being displayed.
Based on the same inventive concept, the application provides an embodiment of a page display system corresponding to the embodiment, which is detailed in the third embodiment
EXAMPLE III
As shown in fig. 3, a third embodiment of the present invention provides a page display system, which includes:
each sub-class controller 1 corresponds to a preset function type parameter, the function type parameter is used for representing a display function type required by page display, and the function type parameter is also used for marking a creating function type corresponding to the sub-class controller 1;
the parent controller 2 is configured with a custom inheritance function and call addresses of various page display functions, is used for utilizing the custom inheritance function to inherit the call addresses of the page display functions corresponding to the function type parameters in the parent controller 2 according to the function type parameters, and is also used for storing the function type parameters into the corresponding child controllers 1;
a display address acquisition unit 3, configured to acquire a page display address to be displayed on a page;
and the page display working unit 4 is used for acquiring page display data to be displayed and performing page display work by utilizing the various sub-controllers 1.
According to the embodiment of the invention, a father controller is firstly created, the father controller is configured with a user-defined inheritance function, a plurality of child controllers are created according to the page display requirement, the father controller is utilized to distribute the calling address of each page display function to each child controller according to the page display requirement, and then each child controller is directly utilized to carry out page display work by means of each page display function, so that the programs required by the page display work are more simplified, the work efficiency of the page display work is improved, and the programming workload is reduced.
In the embodiment of the invention, firstly, a father controller 2 is created and configured with a self-defined inheritance function;
then, presetting a plurality of function type parameters, wherein the function type parameters are used for representing the creation function type required by page display;
it should be noted that the function type parameter may specifically be a display function type required for page display, such as a background color, a page size, a page font, and the like of a page during display, that is, each function type parameter corresponds to a display function type of a page, and the custom inheritance function establishes a relationship between each function type parameter and each page display function, and when the custom inheritance function obtains the function type parameter, the custom inheritance function can obtain a call address of the page display function corresponding to the function type parameter according to the function type parameter, so as to perform inheritance work;
the page display function is specifically a function which is used for completing different page display tasks in the page display working process, such as setting work of page background color, page size, page font and other items when a page is displayed;
furthermore, a plurality of sub-class controllers 1 are created, each sub-class controller 1 corresponds to a function type parameter, that is, each sub-class controller 1 actually corresponds to a page display function, and one sub-class controller 1 corresponds to a page display function;
two user-defined storage files are preset in the subclass controller 1, the user-defined storage files are used for storing function type parameters corresponding to the subclass controller 1, and the user-defined calling files are used for storing calling addresses of page display functions corresponding to the function type parameters corresponding to the subclass controller 1;
the parent controller 2 is configured with a custom inheritance function and calling addresses of various page display functions, is used for utilizing the custom inheritance function to inherit the calling address of the page display function corresponding to the function type parameter in the parent controller 2 according to the function type parameters, and is also used for storing the function type parameter into the corresponding child controller 1;
further, storing the function type parameter into the corresponding sub-type controller 1, wherein the function type parameter is also used for marking the creating function type corresponding to the sub-type controller 1;
after the above steps are all completed, starting the working step of page display, and acquiring a page display address required to be displayed;
acquiring page display requirement data to be displayed, and performing page display work by utilizing each subclass controller 1;
it should be noted that, when performing page display, the page display requirement data that needs to be performed page display and the page display address that needs to be performed page display should be acquired, and page display work is performed by means of each sub-controller 1 according to the page display requirement data.
The embodiment of the invention has the advantages that when the page display work is carried out, the page display method is consistent with the conventional page display means, and the page display method has the advantages that each page display function is used by means of each subclass controller 1, so that the workload of code compiling is reduced, the working efficiency is improved, and the risk of code compiling errors is reduced;
in the embodiment of the invention, a plurality of subclass controllers 1 are actually formulated according to requirements, one subclass controller 1 corresponds to a function required by page display, so that when the page display is carried out, a large number of codes do not need to be input, the existing page display function does not need to be written repeatedly, when a certain page display function needs to be used, the corresponding subclass controller 1 is directly called, the complexity of the program is reduced, and the workload during programming is reduced.
Based on the same inventive concept, the application provides an embodiment of a storage medium corresponding to the embodiment, which is detailed in the fourth embodiment
Example four
A fourth embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, which, when being executed by a processor, implements all or part of the method steps of the first to second embodiments.
The present invention can implement all or part of the processes in the first to second embodiments, and can also be implemented by using a computer program to instruct related hardware, where the computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, in accordance with legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunications signals.
Based on the same inventive concept, the present application provides an embodiment of an electronic device corresponding to embodiment one, which is detailed in embodiment five
EXAMPLE five
The fourth embodiment of the present invention further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program running on the processor, and the processor executes the computer program to implement all or part of the method steps in the first to second embodiments.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being the control center of the computer device and the various interfaces and lines connecting the various parts of the overall computer device.
The memory may be used to store computer programs and/or modules, and the processor may implement various functions of the computer device by executing or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, server, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), servers and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.