CN114528517A - View processing method and device, electronic equipment and computer readable medium - Google Patents

View processing method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN114528517A
CN114528517A CN202210119125.0A CN202210119125A CN114528517A CN 114528517 A CN114528517 A CN 114528517A CN 202210119125 A CN202210119125 A CN 202210119125A CN 114528517 A CN114528517 A CN 114528517A
Authority
CN
China
Prior art keywords
view
parent
sub
target object
identifier
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.)
Pending
Application number
CN202210119125.0A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202210119125.0A priority Critical patent/CN114528517A/en
Publication of CN114528517A publication Critical patent/CN114528517A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Abstract

The application discloses a view processing method, a view processing device, electronic equipment and a computer readable medium, which relate to the technical field of computers, and the method comprises the following steps: receiving a view processing request, and acquiring a corresponding sub-view identifier; determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes; creating an observation object, adding the observation object as an associated object of a parent view based on an associated object mechanism, responding to the destroy of the observation object, calling a callback mechanism, and removing the monitoring of the target object attribute of the parent view. The destruction observation of the child view on the target object attribute of the parent view is realized through the associated object, the repeated work is less, the code maintenance is simple, and the display state and the display part size of the child view are accurately acquired.

Description

View processing method and device, electronic equipment and computer readable medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a view, an electronic device, and a computer-readable medium.
Background
At present, the content in the Application software (Application) is usually presented by list display, and in some scenes, such as exposure statistics, the state of the content currently presented in the list needs to be known: whether fully visible, partially visible, or invisible, what the visible portion is when partially visible. The existing processing mode has more repeated work, places needing to acquire visible contents need to be processed, and code maintenance is complex.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art:
the existing processing mode for acquiring the state of the content displayed by the current list in the application software has more repeated work, each place needing to acquire the visible content needs to be processed, and the code maintenance is complicated.
Disclosure of Invention
In view of this, embodiments of the present application provide a view processing method and apparatus, an electronic device, and a computer-readable medium, which can solve the problems that the existing processing manner for obtaining the state of the content displayed in the current list in the application software is more in repetitive work, each place where the visible content needs to be obtained needs to be processed, and the code maintenance is complicated.
To achieve the above object, according to an aspect of an embodiment of the present application, there is provided a view processing method including:
receiving a view processing request, and acquiring a corresponding sub-view identifier;
determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes;
creating an observation object, adding the observation object as an association object of the parent view based on an association object mechanism, and calling a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object.
Optionally, before updating the target object attribute in the sub-view corresponding to the sub-view identifier, the method further includes:
and detecting the rolling offset of the parent view corresponding to the parent view identification in real time, and determining that the attribute of the target object of the parent view changes in response to determining that the rolling offset changes.
Optionally, updating the sub-view target object attribute corresponding to the sub-view identifier includes:
determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view;
determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction;
and updating the object attribute of the sub-view corresponding to the sub-view identification based on the position coordinate.
Optionally, updating the sub-view target object attribute corresponding to the sub-view identifier based on the position coordinates includes:
determining the size of a display part of the child view in the current parent view based on the position coordinates;
based on the display portion size, the update sub-view identifies the corresponding sub-view target object property.
Optionally, based on the size of the display portion, updating the attribute of the target object of the sub-view corresponding to the sub-view identifier includes:
in response to determining that the display portion size is less than the preset threshold, determining that the display state is invisible, otherwise, visible.
Optionally, based on the size of the display portion, updating the attribute of the target object of the sub-view corresponding to the sub-view identifier includes:
and in response to the fact that the size of the display part is larger than the preset threshold value, determining the rolling offset of the sub-view corresponding to the sub-view identifier based on the size of the display part, and further updating the attribute of the sub-view target object corresponding to the sub-view identifier.
Optionally, removing the snoops on the parent view target object properties comprises:
and in response to detecting that the preset callback function corresponding to the associated object is called, determining that the parent view corresponding to the parent view identifier is destroyed, and removing the monitoring on the target object attribute of the parent view.
In addition, the present application also provides a view processing apparatus, including:
the receiving unit is configured to receive the view processing request and acquire a corresponding sub-view identifier;
the updating unit is configured to determine a parent view identifier corresponding to the child view identifier, call a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and call a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes;
and the removing unit is configured to create an observation object, add the observation object to identify the associated object of the corresponding parent view for the parent view based on the associated object mechanism, and call a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object.
Optionally, the update unit is further configured to:
and detecting the rolling offset of the parent view corresponding to the parent view identification in real time, and determining that the attribute of the target object of the parent view changes in response to determining that the rolling offset changes.
Optionally, the update unit is further configured to:
determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view;
determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction;
and updating the object attribute of the sub-view corresponding to the sub-view identification based on the position coordinate.
Optionally, the update unit is further configured to:
determining the size of a display part of the child view in the current parent view based on the position coordinates;
based on the display portion size, the update sub-view identifies the corresponding sub-view target object property.
Optionally, the update unit is further configured to:
in response to determining that the display portion size is less than the preset threshold, determining that the display state is invisible, otherwise, visible.
Optionally, the update unit is further configured to:
and in response to the fact that the size of the display part is larger than the preset threshold value, determining the rolling offset of the sub-view corresponding to the sub-view identifier based on the size of the display part, and further updating the attribute of the sub-view target object corresponding to the sub-view identifier.
Optionally, the removing unit is further configured to:
and in response to detecting that the preset callback function corresponding to the associated object is called, determining that the parent view corresponding to the parent view identifier is destroyed, and removing the monitoring on the target object attribute of the parent view.
In addition, the present application also provides a view processing electronic device, including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement the view processing method as described above.
In addition, the present application also provides a computer readable medium, on which a computer program is stored, which when executed by a processor implements the view processing method as described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of obtaining corresponding sub-view identification by receiving a view processing request; determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes; creating an observation object, adding the observation object as an association object of the parent view based on an association object mechanism, and calling a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object. The child view is used for destroying and observing the target object attribute of the parent view, a wider rolling scene is supported, repeated work is less, code maintenance is simple, the accurate display state and the display part size of the child view can be obtained, and a universal solution capable of accurately acquiring the display state and the information of the list content in real time is provided.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a further understanding of the application and are not to be construed as limiting the application. Wherein:
fig. 1 is a schematic diagram of a main flow of a view processing method according to a first embodiment of the present application;
fig. 2 is a schematic diagram of a main flow of a view processing method according to a second embodiment of the present application;
fig. 3 is a schematic view of an application scenario of a view processing method according to a third embodiment of the present application;
FIG. 4 is a schematic diagram of the main units of a view processing apparatus according to an embodiment of the present application;
FIG. 5 is an exemplary system architecture diagram to which embodiments of the present application may be applied;
fig. 6 is a schematic structural diagram of a computer system suitable for implementing the terminal device or the server according to the embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a view processing method according to a first embodiment of the present application, and as shown in fig. 1, the view processing method includes:
step S101, receiving a view processing request, and acquiring a corresponding sub-view identifier.
In this embodiment, an execution main body (for example, a processor of a terminal) of the view processing method may receive a view processing request sent by a user through a wired connection or a wireless connection. Specifically, the view processing request may be a request to acquire a content display state of the sub-view in the scroll view and display content in the sub-view based on the content display state. In particular, the content display state may include content fully visible, partially visible, and invisible; when partially visible, what the visible portion is, and so on. The sub-view identifier may be, for example, a position coordinate of the sub-view, a name of the sub-view, a size of the sub-view, or the like, and the specific content of the sub-view identifier is not limited in the embodiment of the present application.
Step S102, determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes.
The child view is a small view in the parent view (i.e., the scroll view). The sub-view is not limited to specific displayed content, a text may be displayed, or a picture or a video may be displayed.
The execution principal may determine a corresponding parent view identification, e.g., a, from the child view identification, e.g., a. The executing agent may invoke a listener corresponding to the child view identification and the corresponding parent view identification to listen for the parent view target object attribute corresponding to the parent view identification based on the listening mechanism of the listener. The target object attribute may be, for example, a contentOffSet, which is an attribute of the uisrolview (i.e., the parent view), and represents a scroll offset of the uisrolview (i.e., the parent view), and when a change in the scroll offset of the parent view is detected (i.e., when the parent view is detected to be scrolled), the execution subject updates a value of the target object attribute.
Specifically, updating the sub-view target object attribute corresponding to the sub-view identifier includes:
determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view; determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction; and updating the object attribute of the sub-view corresponding to the sub-view identification based on the position coordinate.
For example, the executing agent may first obtain the scroll offset of the latest parent view, that is, the contentOffSet of the latest uiscrilview, by listening to KVO of the contentOffSet attribute of the parent view. Then, the execution subject may convert the coordinates of the current sub-View (i.e. the sub-View) into the uiScrollView coordinate system, and calculate the position of the X or Y of the sub-View in the UIScrollView according to the scrolling direction of the UIScrollView, to obtain the current state (the current state of the sub-View may include content fully visible, partially visible and invisible; when partially visible, how much the visible part is, etc.) and the display size of the sub-View. And transmitting the calculation result to the user through a callback.
Specifically, updating the sub-view target object attribute corresponding to the sub-view identifier based on the position coordinates includes:
based on the position coordinates, the display portion size of the child view in the current parent view is determined. The display portion size, for example, the size of the child view from the top, bottom, left, and right margins of the current parent view. The execution principal may then update the child view in the parent view to identify the corresponding child view target object property based on the display portion size. The child view target object property, i.e., the child view, identifies the scroll offset of the corresponding child view relative to the parent view. Therefore, the content display state of the child view in the parent view and the position of the child view in the parent view can be accurately positioned.
Specifically, based on the size of the display part, updating the attribute of the sub-view target object corresponding to the sub-view identifier includes:
in response to determining that the display portion size is less than the preset threshold, determining that the display state is invisible, otherwise, visible. Specifically, when the size of the display portion of the sub-view is too small to be smaller than a preset threshold, the display state of the content of the sub-view is determined to be invisible, that is, the content of the sub-view is not shown. The preset threshold may be a preset size of a display portion where the corresponding content is visible. That is, the attribute of the sub-view target object corresponding to the sub-view identifier is updated to be invisible, and the sub-view corresponding to the sub-view identifier is not displayed.
Specifically, based on the size of the display part, updating the attribute of the sub-view target object corresponding to the sub-view identifier includes:
and in response to the fact that the size of the display part is larger than the preset threshold value, determining the rolling offset of the sub-view corresponding to the sub-view identifier based on the size of the display part, and further updating the attribute of the target object of the sub-view corresponding to the sub-view identifier. That is, based on the determined scroll offset of the sub-view corresponding to the sub-view identifier, it is determined whether the content display state of the sub-view is completely visible or partially visible or invisible, and if the content is partially visible, the size of the visible portion is determined, and accordingly, the attribute of the target object of the sub-view corresponding to the sub-view identifier at the current time (i.e., the scroll offset of the sub-view) is updated, and further, the content and the position of the corresponding sub-view are updated and displayed.
Step S103, an observation object is created, the observation object is added to serve as the correlation object of the parent view corresponding to the parent view identification based on the correlation object mechanism, and a callback mechanism is called to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object.
Specifically, the execution subject may add a self-defined AssociatedObject, that is, an observation object, to the parent view uisrolview object, and add the observation object as an association object of the parent view based on an association mechanism, so as to monitor whether a page corresponding to the parent view is closed and whether a page view resource is destroyed. When UIScrollView is destroyed, its associatedObject is also destroyed, and the remove KVO snoop is performed in the dealloc of the associatedObject. For example, the executing agent may add a class to the parent view for observing the destruction of the specified object, and issue a notification or callback when the specified object (i.e., the observed object) is destroyed. For example: the new class name is: jdobjectdeallocatch, where the add method: the WatchObjectDealloc. Calllback. the method contains two parameters: the first parameter WatchObject Delloc is an observed object; the second parameter callback is a callback function, which is the callback processing when the object is destroyed. Dealloc: the method executed when the object is destroyed, wherein the callback transmitted in the watchObjectDealloc callback is executed in the method. When the child view adds monitoring to the uisrolview, a jdobjectdeallocatch object may be created at the same time (this object is the associated object of the aforementioned uisrolview, and is used to obtain a destroy time of the uisrolview, and is used to remove KVO monitoring on the uisrolview when the uisrolview is destroyed, and when the uisrolview is destroyed, the associated object is also destroyed, and when the associated object is destroyed, a dealloc method is executed, and an execution subject may remove KVO monitoring of the uisrolview in the associated object dealloc), and call watchObjectDealloc: callback: the method introduces uisrolview and a callback for executing KVO removal. The execution body adds the created JDObjectDealloC Watcher object as an associated object of UIScrollView and specifies its memory policy as Retain. The Retain represents holding, and when the associated object is added to the uiScrollView, and the policy is used, the uiScrollView (i.e. the parent view) will Retain the holding relationship of the associated object, so as to ensure that the associated object exists during the existence of the UIScrollView.
Specifically, removing the snoops on the parent view target object attributes includes:
the execution subject determines that the parent view corresponding to the parent view identifier is destroyed in response to detecting that the preset callback function corresponding to the associated object is called, further destroys the associated object (for example, jdobjectdeallocatter), and removes the monitoring of the child view on the object attribute of the parent view.
In the embodiment of the application, Objective-C: a programming language is mainly used for developing application programs of an iOS system. KVO: key Value observer is a set of event notification mechanism. In the program it is allowed to listen for changes in a particular property of another object and to receive events when changed. Because of the implementation mechanism of KVO, actions only occur for attributes, and objects that are inherited from NSObject generally support KVO by default. And (4) classification: category, is a property of the Objective-c programming language that adds methods to existing classes. Uiscrillview: is a view that allows the view it contains to be scrolled or zoomed within its scope. Are parent classes of UITableView, UICollectionView, UITextView, etc. that also support scrolled views. ContentOffSet: is an attribute on the uiScrollView that represents the scroll offset of the UIScrollView. UIView: view objects, objects of screen-presented UI elements, manage the presentation of their content. NSObject: is the root class of object types in the Objective-C programming language type system, and all object types inherit the type. Association and object: namely, the related object is the characteristic that a plurality of objects can be related in Objective-C, and the purpose of dynamically adding attributes to the objects can be achieved. method swizzle: a mechanism that can replace the original method. dealloc: the system defaults to a method that executes an object when it is destroyed. The method can be rewritten in development so as to clean up related resources when the object is destroyed. Retain: an object reference management policy in object-C, representing strong references.
In the embodiment, a view processing request is received, and a corresponding sub-view identifier is acquired; determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes; creating an observation object, adding the observation object as an association object of the parent view based on an association object mechanism, and calling a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object. The child view is used for destroying and observing the target object attribute of the parent view, a wider rolling scene is supported, repeated work is less, code maintenance is simple, the accurate display state and the display part size of the child view can be obtained, and a universal solution capable of accurately acquiring the display state and the information of the list content in real time is provided.
Fig. 2 is a schematic main flow diagram of a view processing method according to a second embodiment of the present application, and as shown in fig. 2, the view processing method includes:
step S201, receiving a view processing request, and acquiring a corresponding sub-view identifier.
The principle of step S201 is similar to that of step S101, and is not described here.
Step S202, determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor the parent view target object attribute corresponding to the parent view identifier, detecting the rolling offset of the parent view corresponding to the parent view identifier in real time, determining the parent view target object attribute change in response to the determined rolling offset, and calling a callback mechanism to update the child view target object attribute corresponding to the child view identifier in response to the determined parent view target object attribute change.
Specifically, the parent view uiscrillview is the most basic and most common scrolling view from which both UITableView and UICollectionView inherit. The contentOffset attribute in UIScrollView represents the scroll offset of the list. And converting and comparing the X or Y of the sub-view in the UIScrollView with the contentOffset to obtain the accurate display state and the size of the display part of the sub-view. KVO is an observer pattern feature by which the contentOffset attribute of the parent view uisrolview can be snooped, and any change that results in a contentOffset attribute can execute the relevant callback. The implementation manner of the embodiment of the application is divided into two parts: the KVO monitors the list to roll and calculate; KVO is removed. By detecting the rolling offset of the parent view corresponding to the parent view identifier in real time, when the rolling offset of the parent view is detected to be changed, the execution main body can determine that the attribute of the target object of the parent view is changed, so that the rolling offset of the approximate parent view is determined, and then the content display state of the child view and the relative position of the child view are calculated based on the rolling offset of the parent view, so that the child view is correspondingly displayed.
Step S203, an observation object is created, based on the associated object mechanism, the observation object is added to identify the associated object of the corresponding parent view for the parent view, and in response to the destruction of the observation object, a callback mechanism is called to remove the monitoring of the target object attribute of the parent view.
The principle of step S203 is similar to that of step S103, and is not described here.
Fig. 3 is a schematic view of an application scenario of a view processing method according to a third embodiment of the present application. The view processing method of the embodiment of the application can be applied to a scene for accurately acquiring the display state of the scroll view content in application software. As shown in FIG. 3, a handler 302 in the processor receives a view processing request 301 and obtains a corresponding sub-view identifier 303. The handler 302 in the processor determines a parent view identifier 304 corresponding to the child view identifier 303, invokes the listening mechanism 305 to listen for a parent view target object attribute 307 in the parent view 306 corresponding to the parent view identifier 304 based on the child view identifier 303 and the parent view identifier 304, and invokes the callback mechanism 308 to update the child view target object attribute 310 in the child view 309 corresponding to the child view identifier 303 in response to determining that the parent view target object attribute 307 has changed. The handler 302 in the processor creates an observed object 311, adds the observed object 311 to the associated object of the parent view 306 corresponding to the parent view identification 304 based on the associated object mechanism 312, and in response to the destruction of the observed object 311, invokes the callback mechanism 313 to remove the snoop to the parent view target object property 307.
Fig. 4 is a schematic diagram of main units of a view processing apparatus according to an embodiment of the present application. As shown in fig. 4, the view processing apparatus includes a receiving unit 401, an updating unit 402, and a removing unit 403.
The receiving unit 401 is configured to receive the view processing request and obtain the corresponding sub-view identifier.
An updating unit 402 configured to determine a parent view identifier corresponding to the child view identifier, invoke a monitoring mechanism to monitor a parent view target object attribute corresponding to the parent view identifier according to the child view identifier and the parent view identifier, and invoke a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes.
The removing unit 403 is configured to create an observation object, add the observation object to identify an associated object of a corresponding parent view for the parent view based on an associated object mechanism, and invoke a callback mechanism to remove monitoring on the target object attribute of the parent view in response to destruction of the observation object.
In some embodiments, the updating unit 402 is further configured to: and detecting the rolling offset of the parent view corresponding to the parent view identification in real time, and determining that the attribute of the target object of the parent view changes in response to determining that the rolling offset changes.
In some embodiments, the updating unit 402 is further configured to: determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view; determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction; and updating the object attribute of the sub-view corresponding to the sub-view identification based on the position coordinate.
In some embodiments, the updating unit 402 is further configured to: determining the size of the display part of the child view in the current parent view based on the position coordinates; based on the display portion size, the update sub-view identifies the corresponding sub-view target object property.
In some embodiments, the updating unit 402 is further configured to: in response to determining that the display portion size is less than the preset threshold, determining that the display state is invisible, otherwise, visible.
In some embodiments, the updating unit 402 is further configured to: and in response to the fact that the size of the display part is larger than the preset threshold value, determining the rolling offset of the sub-view corresponding to the sub-view identifier based on the size of the display part, and further updating the attribute of the sub-view target object corresponding to the sub-view identifier.
In some embodiments, the removal unit 403 is further configured to: and in response to detecting that the preset callback function corresponding to the associated object is called, determining that the parent view corresponding to the parent view identifier is destroyed, and removing the monitoring on the target object attribute of the parent view.
It should be noted that, in the present application, the view processing method and the view processing apparatus have corresponding relation in the specific implementation contents, and therefore, the description of the repeated contents is omitted.
Fig. 5 illustrates an exemplary system architecture 500 to which the view processing method or view processing apparatus of the embodiments of the present application may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having view processing screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for view processing requests submitted by users using the terminal devices 501, 502, 503. The background management server can receive the view processing request and acquire the corresponding sub-view identifier; determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes; creating an observation object, adding the observation object as an association object of the parent view based on an association object mechanism, and calling a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object. The child view is used for destroying and observing the target object attribute of the parent view, a wider rolling scene is supported, repeated work is less, code maintenance is simple, the accurate display state and the display part size of the child view can be obtained, and a universal solution capable of accurately acquiring the display state and the information of the list content in real time is provided.
It should be noted that the view processing method provided in the embodiment of the present application is generally executed by the server 505, and accordingly, the view processing apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a terminal device of an embodiment of the present application. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the computer system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output section 607 including a signal processing section such as a Cathode Ray Tube (CRT), a liquid crystal credit authorization inquiry processor (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to embodiments disclosed herein, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present application are executed when the computer program is executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, an updating unit, and a removing unit. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs, and when the one or more programs are executed by one of the devices, the device receives a view processing request and acquires a corresponding sub-view identifier; determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes; creating an observation object, adding the observation object as an association object of the parent view based on an association object mechanism, and calling a callback mechanism to remove monitoring on the target object attribute of the parent view in response to the destruction of the observation object.
According to the technical scheme of the embodiment of the application, the child view is used for destroying and observing the target object attribute of the parent view, a wider rolling scene is supported, repeated work is less, code maintenance is simple, the accurate display state and the display part size of the child view can be obtained, and a universal solution capable of accurately acquiring the display state and the information of the list content in real time is provided.
The above-described embodiments should not be construed as limiting the scope of the present application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A method for view processing, comprising:
receiving a view processing request, and acquiring a corresponding sub-view identifier;
determining a parent view identifier corresponding to the child view identifier, calling a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and calling a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes;
creating an observation object, adding the observation object to identify the corresponding correlation object of the parent view for the parent view based on a correlation object mechanism, and calling a callback mechanism to remove monitoring on the attribute of the target object of the parent view in response to the destruction of the observation object.
2. The method of claim 1, wherein prior to said updating the target object property in the child view identified the corresponding child view, the method further comprises:
and detecting the rolling offset of the parent view corresponding to the parent view identification in real time, and determining that the attribute of the parent view target object changes in response to determining that the rolling offset changes.
3. The method of claim 1, wherein the updating the child view object attributes to identify corresponding child view object attributes comprises:
determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view;
determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction;
and updating the sub-view target object attribute corresponding to the sub-view identification based on the position coordinate.
4. The method of claim 3, wherein updating the sub-view target object property corresponding to the sub-view identifier based on the location coordinates comprises:
determining a display portion size of the child view in the current parent view based on the location coordinates;
and updating the attribute of the target object of the sub-view corresponding to the sub-view identification based on the display part size.
5. The method of claim 4, wherein updating the sub-view target object property corresponding to the sub-view identifier based on the display portion size comprises:
in response to determining that the display portion size is less than a preset threshold, determining that the display state is invisible, otherwise visible.
6. The method of claim 4, wherein updating the sub-view target object property corresponding to the sub-view identifier based on the display portion size comprises:
and in response to the fact that the display part size is larger than the preset threshold value, determining the scroll offset of the sub-view corresponding to the sub-view identifier based on the display part size, and further updating the attribute of the sub-view target object corresponding to the sub-view identifier.
7. The method of claim 1, wherein the removing listening to the parent view target object property comprises:
and in response to detecting that the preset callback function corresponding to the associated object is called, determining that the parent view corresponding to the parent view identifier is destroyed, and removing monitoring on the target object attribute of the parent view.
8. A view processing apparatus, characterized by comprising:
the receiving unit is configured to receive the view processing request and obtain a corresponding sub-view identifier;
the updating unit is configured to determine a parent view identifier corresponding to the child view identifier, call a monitoring mechanism according to the child view identifier and the parent view identifier to monitor a parent view target object attribute corresponding to the parent view identifier, and call a callback mechanism to update a child view target object attribute corresponding to the child view identifier in response to determining that the parent view target object attribute changes;
and the removing unit is configured to create an observation object, add the observation object to identify the associated object of the corresponding parent view for the parent view based on an associated object mechanism, and invoke a callback mechanism to remove monitoring on the attribute of the target object of the parent view in response to the destruction of the observation object.
9. The apparatus of claim 8, wherein the update unit is further configured to:
and detecting the rolling offset of the parent view corresponding to the parent view identification in real time, and determining that the attribute of the parent view target object changes in response to determining that the rolling offset changes.
10. The apparatus of claim 8, wherein the update unit is further configured to:
determining a coordinate system of a current parent view corresponding to the parent view identification and a rolling direction of the current parent view;
determining the position coordinates of the sub-view corresponding to the sub-view identification based on the coordinate system and the rolling direction;
and updating the sub-view target object attribute corresponding to the sub-view identification based on the position coordinate.
11. A view processing electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202210119125.0A 2022-02-08 2022-02-08 View processing method and device, electronic equipment and computer readable medium Pending CN114528517A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210119125.0A CN114528517A (en) 2022-02-08 2022-02-08 View processing method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210119125.0A CN114528517A (en) 2022-02-08 2022-02-08 View processing method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN114528517A true CN114528517A (en) 2022-05-24

Family

ID=81622966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210119125.0A Pending CN114528517A (en) 2022-02-08 2022-02-08 View processing method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN114528517A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115396546A (en) * 2022-07-22 2022-11-25 上海万物新生环保科技集团有限公司 Conflict processing method and device for sliding event
CN116521039A (en) * 2023-04-28 2023-08-01 成都赛力斯科技有限公司 Method and device for moving covered view, electronic equipment and readable storage medium
CN116501205B (en) * 2023-04-28 2024-04-26 重庆赛力斯凤凰智创科技有限公司 Method and device for moving covered view, electronic equipment and readable storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115396546A (en) * 2022-07-22 2022-11-25 上海万物新生环保科技集团有限公司 Conflict processing method and device for sliding event
CN115396546B (en) * 2022-07-22 2023-10-27 上海万物新生环保科技集团有限公司 Conflict processing method and device for sliding event
CN116521039A (en) * 2023-04-28 2023-08-01 成都赛力斯科技有限公司 Method and device for moving covered view, electronic equipment and readable storage medium
CN116521039B (en) * 2023-04-28 2024-04-02 重庆赛力斯凤凰智创科技有限公司 Method and device for moving covered view, electronic equipment and readable storage medium
CN116501205B (en) * 2023-04-28 2024-04-26 重庆赛力斯凤凰智创科技有限公司 Method and device for moving covered view, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN114528517A (en) View processing method and device, electronic equipment and computer readable medium
CN108011949B (en) Method and apparatus for acquiring data
CN111190673B (en) Page display method and device based on operation monitoring and electronic equipment
CN109582317B (en) Method and apparatus for debugging hosted applications
CN113760324A (en) Method and device for constructing micro front-end application
CN111459364A (en) Icon updating method and device and electronic equipment
CN113505302A (en) Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment
CN112416632A (en) Event communication method and device, electronic equipment and computer readable medium
CN108764866B (en) Method and equipment for allocating resources and drawing resources
WO2019237592A1 (en) Data monitoring method and apparatus, computer device, and storage medium
CN112118352B (en) Method and device for processing notification trigger message, electronic equipment and computer readable medium
CN112926068A (en) Authority management method, management server, service server and readable storage medium
CN108933823B (en) User touch method and device
CN115470432A (en) Page rendering method and device, electronic equipment and computer readable medium
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN113760487B (en) Service processing method and device
CN113742617A (en) Cache updating method and device
CN114490126A (en) Page processing method and device, electronic equipment and storage medium
CN112947918A (en) Data display method and device
CN112799558A (en) Information processing method, information processing device, electronic equipment and storage medium
CN112579447A (en) Browser testing method and device
CN113452738A (en) Page loading method and client
CN111367898A (en) Data processing method, device, system, electronic equipment and storage medium
US20140215392A1 (en) Connections identification
CN114428823B (en) Data linkage method, device, equipment and medium based on multidimensional variable expression

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