Disclosure of Invention
Embodiments of the present invention provide a view display method and apparatus, an electronic device, and a storage medium, which can achieve correct display of each view, effectively manage display levels of each view, and avoid a problem of disordered display levels of views.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a view display method, where the method includes:
determining display priority among the views, and adding priority marks for the views;
when the view to be displayed needs to be displayed in a page, sending a view to be displayed adding request carrying a priority identifier to a container view so as to add the view to be displayed to the container view;
and performing page display on the view to be displayed through the container view according to the priority identification of the view to be displayed.
Further, the determining the display priority between the views includes:
determining the display level of each view in the root view based on the business function of each view;
and determining the display priority among the views according to the display hierarchy of the views in the root view.
Further, the sending the to-be-displayed view adding request carrying the priority identifier to the container view to add the to-be-displayed view to the container view includes:
sending the view to be displayed adding request carrying the priority identification to the container view by calling the following system functions:
(void)ui_requestAddCoverView:(UIView*)viewwithPriority:(DYBoxLayoutPriority)prioritydescriptor:(NSString*)descriptor
wherein, the parameter UIView represents the view to be displayed, the parameter dypoxlayoutpriority represents the priority identifier of the view to be displayed, and the parameter NSString represents the descriptor of the container view.
Further, the performing, by the container view, page display on the view to be displayed according to the priority identifier of the view to be displayed includes:
sequencing the priority identifications of the views to be displayed which send the adding requests through the container views;
sequentially displaying the views to be displayed according to the sequence of the priority marks from low to high;
wherein the priority identification is a number.
Further, the performing, by the container view, page display on the view to be displayed according to the priority identifier of the view to be displayed includes:
sequencing the priority identifications of the views to be displayed and the views in the display state, which send the adding requests, through the container views;
sequentially displaying each view according to the sequence of the priority marks from low to high;
wherein, each view comprises the view to be displayed and the view in the display state, and the priority mark is a number.
Further, displaying each view comprises:
and displaying each view by calling a view display interface.
In a second aspect, an embodiment of the present invention provides a view display apparatus, including:
the priority determining module is used for determining the display priority among the views and adding priority marks to the views;
the adding request sending module is used for sending a view adding request carrying a priority identifier to the container view when the view to be displayed needs to be subjected to page display so as to add the view to be displayed to the container view;
and the display module is used for performing page display on the view to be displayed according to the priority identifier of the view to be displayed through the container view.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the view display method according to the first aspect.
In a fourth aspect, embodiments of the present invention provide a storage medium containing computer-executable instructions which, when executed by a computer processor, implement the view display method as described in the first aspect above.
According to the view display method provided by the embodiment of the invention, the display priority among the views is determined, the priority identification is added to the views, the direct relation among the views is established through the priority identification, when a certain view has a display requirement, an adding request carrying the priority identification is sent to the container view, then the container view is compared with the priority identification of other views needing to be displayed according to the priority identification, and the views needing to be displayed are displayed according to the comparison result, so that the problem that the newly added views shield other views is avoided, the problem that the display levels of the views are disordered is solved, the display levels of the views are effectively managed, and the correct display of the views is ensured.
Detailed Description
In order to make the technical problems solved, technical solutions adopted and technical effects achieved by the present invention clearer, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all 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.
Example one
Fig. 1 is a schematic flow chart of a view display method according to an embodiment of the present invention. The view display method disclosed in this embodiment may be used to solve the problem of disordered view display levels in a live broadcast room, and the view display method may be executed by a view display device, which may be implemented by software and/or hardware, and is generally integrated in a terminal based on an iOS system, such as a smart phone or a computer. Referring specifically to fig. 1, the view display method includes the steps of:
110. and determining display priority among the views, and adding priority identification to the views.
Illustratively, the determining the display priority between the views includes:
determining the display level of each view in the root view based on the business function of each view;
and determining the display priority among the views according to the display hierarchy of the views in the root view.
The root view is a blank page for displaying the sub-views, for example, a background page of a desktop of a mobile phone is a root view, various clients on the desktop are the sub-views displayed on the root view, and the sub-views are collectively referred to as views in this embodiment. The display level refers to the height of the display layer, for example, view 2 needs to be displayed on view 1, i.e., view 2 has a higher display level than view 1, and view 1 has a lower display level than view 2, so that the display priority of view 1 can be set to be lower than that of view 2, i.e., the higher the display level of the view is, the higher the display priority of the view is.
The business function of a view specifically refers to the function and role of the view. Typically, views are created according to the business function that it is to implement, with different business functions corresponding to different views. For example, a view for implementing a login function is called a login box view, and the login box view needs to be displayed on the top of a corresponding root view in order for a user to implement the login function through a login box, and thus, the login box view generally has the highest display priority.
In order to quickly identify the display priority of each view, a priority identifier in the form of a number may be added to each view, for example, the priority identifier is 1,2,3, … … n, where n is a natural number, and a larger number indicates a higher priority, and a higher priority indicates a higher display level of the corresponding view.
120. When the view to be displayed needs to be displayed in a page, sending a view to be displayed adding request carrying a priority identifier to a container view so as to add the view to be displayed to the container view.
When a certain view receives a display instruction, the view has a display requirement, and the view needs to be displayed on a page. For example, when a user clicks a "login" button of a live broadcast, an indication for displaying a "login frame view" is triggered, the "login frame view" receives a display instruction, that is, the "login frame view" needs to be displayed on a page, and at this time, a "login frame view" view adding request carrying a priority identifier is sent to a container view, so that the "login frame view" is added to the container view for display. And if no view is added in the container view, only displaying the root view of the blank page.
Illustratively, the sending the to-be-displayed view adding request carrying the priority identifier to the container view to add the to-be-displayed view to the container view includes:
sending the view to be displayed adding request carrying the priority identification to the container view by calling the following system functions:
(void)ui_requestAddCoverView:(UIView*)viewwithPriority:(DYBoxLayoutPriority)prioritydescriptor:(NSString*)descriptor
wherein, the parameter UIView represents the view to be displayed, the parameter dypoxlayoutpriority represents the priority identifier of the view to be displayed, and the parameter NSString represents the descriptor of the container view, which is used for marking the specific container view. Usually, a plurality of container views are set to adapt to different services, such as different bullet screen container views, video stream container views or active container views, and therefore, in order to distinguish between container views, a descriptor of the container views needs to be carried when sending an addition application to identify which container view to send an addition request specifically.
130. And performing page display on the view to be displayed through the container view according to the priority identification of the view to be displayed.
Specifically, the performing, by the container view, page display on the view to be displayed according to the priority identifier of the view to be displayed includes:
sequencing the priority identifications of the views to be displayed and the views in the display state, which send the adding requests, through the container views;
sequentially displaying each view according to the sequence of the priority marks from low to high;
wherein, each view comprises the view to be displayed and the view in the display state, and the priority mark is a number.
The view container is used for managing the display hierarchy of each view according to the priority identifier of each view, specifically, each time a new view is added to the container view, the operation of sorting the new view and the priority identifiers of other views added in the container view is performed once, and then the views are sequentially displayed according to the sequence from the lowest priority identifier to the highest priority identifier, namely, the view with the lowest priority identifier is displayed firstly, and the view with the highest priority identifier is displayed finally. The view that is displayed first is displayed at a lower level of the root view than the view that is displayed later, and the view that is displayed later is displayed at a higher level of the root view than the view that is displayed first. For the views with the same priority identification, the views with the same priority identification are sequentially displayed according to the time sequence of sending the adding request, the view with the adding request sent first is preferentially displayed, the view with the adding request sent later is displayed later, for example, the priority identifications of the view 1, the view 2, the view 3 and the view 4 are the same, the time sequence of sending the adding request is the view 4, the view 2, the view 1 and the view 3, and then the view 4, the view 2, the view 1 and the view 3 are sequentially displayed.
Illustratively, the displaying of the views includes:
and displaying each view by calling a view display interface.
In order to effectively manage the views of various service functions in the live broadcast room, the views of various service functions in the live broadcast room are divided into three modes according to the actual use scenes of the views, namely a grid mode, an attachment mode and an overlay mode, wherein the views in the grid mode refer to the views which have display hidden dependence and position dependence relationship among the views, such as the view of a game entrance icon, a lottery view, an advertisement entrance view, a fish catching pill view, the view of a treasure box and the like; the view in the attached mode generally refers to a view of an attached setting related to the portal, and the view in the attached mode can be closed by clicking other areas of the page, such as a landscape line view, a high-definition view displayed when a user is laterally and horizontally looking; the view in the overlay mode refers to views having a display hierarchical relationship with each other, and presents a page display, such as a pop-up frame view, which is stacked one above another.
According to the view display method provided by the embodiment, the direct relation among the views is established through the priority identifiers, when a certain view has a display requirement, the container view sends an adding request carrying the priority identifier of the certain view to the container view, then the container view is compared with the priority identifiers of other views needing to be displayed according to the priority identifiers, and the views needing to be displayed are displayed according to a comparison result, so that the problem that the newly added views shield other views is avoided, the problem that the display levels of the views are disordered is solved, the display levels of the views are effectively managed, and the views are ensured to be correctly displayed.
Example two
Fig. 2 is a schematic flow chart of a view display method according to a second embodiment of the present invention. On the basis of the above embodiment, this embodiment embodies the above step 130 of performing page display on the view to be displayed according to the priority identifier of the view to be displayed by the container view, "and provides a solution for the case where the view in the display state in the container view is zero. Referring specifically to fig. 2, the method may include the steps of:
210. and determining display priority among the views, and adding priority identification to the views.
220. When the view to be displayed needs to be displayed in a page, sending a view to be displayed adding request carrying a priority identifier to a container view so as to add the view to be displayed to the container view.
230. And sequencing the priority identifications of the views to be displayed which send the adding requests through the container view.
Compared with the embodiment, the embodiment aims at that the views in the display state in the container views are zero, namely, the views to be displayed are directly added to the blank page, at this time, there is no need to worry that the displayed views are blocked by the new views, and only the views to be displayed are not affected with each other, so that the priority identifications of the views to be displayed which send the adding requests are only required to be sorted, the hierarchical relation among the views to be displayed is determined, and then the views to be displayed are displayed according to the sequence.
240. And sequentially displaying the views to be displayed according to the sequence of the priority marks from low to high.
Wherein the priority identification is a number.
According to the view display method provided by the embodiment, the direct relation among the views is established through the priority identifiers, when a certain view has a display requirement, the container view is compared with the other view priority identifiers needing to be displayed according to the priority identifier, and the views needing to be displayed are displayed according to the comparison result, so that the correct display of the views is ensured, the display levels of the views are effectively managed, and the problem of disorder of the display levels of the views is solved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a view display device according to a third embodiment of the present invention. Referring to fig. 3, the apparatus comprises: a priority determination module 310, an addition request transmission module 320, and a display module 330;
the priority determining module 310 is configured to determine a display priority between the views, and add a priority identifier to each view;
an adding request sending module 320, configured to send, when a to-be-displayed view needs to be page-displayed, a to-be-displayed view adding request carrying a priority identifier to a container view, so as to add the to-be-displayed view to the container view;
the display module 330 is configured to perform page display on the view to be displayed according to the priority identifier of the view to be displayed through the container view.
Further, the priority determining module 310 includes:
the display level determining unit is used for determining the display level of each view in the root view based on the service function of each view;
and the priority determining unit is used for determining the display priority among the views according to the display hierarchy of the views in the root view.
Further, the adding request sending module 320 is specifically configured to:
sending the view to be displayed adding request carrying the priority identification to the container view by calling the following system functions:
(void)ui_requestAddCoverView:(UIView*)viewwithPriority:(DYBoxLayoutPriority)prioritydescriptor:(NSString*)descriptor
wherein, the parameter UIView represents the view to be displayed, the parameter dypoxlayoutpriority represents the priority identifier of the view to be displayed, and the parameter NSString represents the descriptor of the container view.
Further, the display module 330 includes:
the sequencing unit is used for sequencing the priority identifiers of the views to be displayed, which send the adding requests, through the container views; or sequencing the priority identifications of the views to be displayed and the views in the display state which send the adding requests through the container view;
the display unit is used for sequentially displaying the views to be displayed according to the sequence of the priority marks from low to high;
wherein, each view comprises the view to be displayed and the view in the display state, and the priority mark is a number.
Further, the display unit is specifically configured to:
and displaying each view by calling a view display interface.
Further, the mode of the view is an overlay mode.
The view display device provided by this embodiment establishes a direct relationship between views through the priority identifiers, and when a certain view has a display requirement, sends an addition request carrying the priority identifier to the container view, and then the container view compares the priority identifier with the priority identifiers of other views to be displayed according to the priority identifier, and displays the views to be displayed according to a comparison result, thereby avoiding the problem that the newly added view blocks other views, solving the problem of disordered display levels of the views, effectively managing the display levels of the views, and ensuring correct display of the views.
EXAMPLE III
Fig. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention. As shown in fig. 4, the electronic apparatus includes: a processor 670, memory 671, and computer programs stored on memory 671 and operable on processor 670; the number of the processors 670 may be one or more, and fig. 4 illustrates one processor 670 as an example; the processor 670, when executing said computer program, implements the view display method as described in the above embodiment one. As shown in fig. 4, the electronic device may further include an input device 672 and an output device 673. The processor 670, memory 671, input device 672 and output device 673 may be connected by a bus or other means, such as by a bus in FIG. 4.
The memory 671 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as the view display apparatus/module (the priority determining module 310, the addition request sending module 320, the display module 330, and the like) in the embodiments of the present invention. The processor 670 executes various functional applications and data processing of the electronic device, i.e., implements the above-described view display method, by executing software programs, instructions, and modules stored in the memory 671.
The memory 671 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, and an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. In addition, the memory 671 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 671 may further include memory located remotely from the processor 670, which may be connected to electronic devices/storage media through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 672 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus. The output device 673 may include a display device such as a display screen.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for displaying a view, the method including:
determining display priority among the views, and adding priority marks for the views;
when the view to be displayed needs to be displayed in a page, sending a view to be displayed adding request carrying a priority identifier to a container view so as to add the view to be displayed to the container view;
and performing page display on the view to be displayed through the container view according to the priority identification of the view to be displayed.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform the view display related operations provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a storage medium, or a network device) to execute the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.