User interaction operation response method and device, equipment and storage medium
By intercepting the call of the first object in the UI control and using the processing logic modification information provided by the second object, the problem of inefficiency caused by the customization of the user interaction method name in the prior art is solved, and a simplified processing logic modification process and improved processing efficiency are achieved.
Patent Information
- Application Number
- CN202510067892.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-01-15
AI Technical Summary
In the prior art, the method names used to respond to user interactions are customized and different, resulting in high labor and low efficiency of intercepting and modifying processing logic one by one based on the method names.
During the process of calling the first object by intercepting the call and determining that the target event corresponding to the user interaction corresponds to the second object, the second object contains processing logic modification information of the target method. Then, the processing logic modification information is forwarded to the first object through the second object, causing it to modify and call the target method of the processing logic modified to generate a response to user interaction.
The processing logic modification process of the target method is simplified, the processing efficiency is improved, the complexity of intercepting methods is avoided, and manpower consumption is reduced.
Smart Images

Figure CN119987924A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of human-computer interaction technology, and in particular to a user interaction operation response method, device, equipment and storage medium. Background Art
[0002] In the User Interface (UI), users can perform various user interaction operations (such as clicking, sliding, etc.). After listening to these user interaction operations, the UI controls will trigger corresponding events. In response to these events being triggered, the UI controls will further call methods in pre-set objects to respond to user interaction operations.
[0003] In the related art, there is a need to intercept the method executed by the UI control for responding to user interaction operations and modify the processing logic of the method (for example, adding customized processing logic), that is, it is necessary to hook the method in the UI control for responding to user interaction operations. However, in actual applications, the name of the method for responding to user interaction operations is often customized, and the methods for responding to user interaction operations involved in different user interfaces may be the same or different. If each method is identified and intercepted one by one based on the name of the method for responding to user interaction operations, it will consume a lot of manpower and be inefficient. Summary of the invention
[0004] Embodiments of the present application provide a user interaction operation response method, apparatus, device, and storage medium to improve the efficiency of modifying the processing logic in a method for responding to a user interaction operation.
[0005] In a first aspect, an embodiment of the present application provides a user interaction operation response method, which is applied to a UI control, and the method includes:
[0006] Get the user interaction operations triggered by the user on the user interface;
[0007] Determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation;
[0008] In response to triggering of a target event, in the process of calling the first object, intercepting the call and determining that the target event corresponds to a second object, the second object including processing logic modification information corresponding to the target method;
[0009] The processing logic modification information is forwarded to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method with modified processing logic to generate a response to the user interaction operation.
[0010] Optionally, in the process of calling the first object, intercepting the call and determining that the target event corresponds to the second object, including: in the process of calling the first object through a first calling method, identifying the method name of the first calling method; in response to identifying the method name of the first calling method, intercepting the call and calling the second object through a second calling method as the object corresponding to the target event.
[0011] Optionally, the method further includes: determining a corresponding relationship between the first object and the second object.
[0012] Optionally, forwarding the processing logic modification information to the first object through the second object includes: sending calling information of the target method to the second object, so that the second object determines the first object containing the target method according to the corresponding relationship, and forwarding the calling information and the processing logic modification information to the first object.
[0013] Optionally, the method further includes: determining, according to the method name of the target method, the processing logic modification information corresponding to the target method from the processing logic modification information corresponding to the plurality of methods included in the second object.
[0014] Optionally, the first object is a delegate object pre-configured for the UI control by defining a protocol or an interface.
[0015] Optionally, the first object is an object that is pre-configured for the UI control by setting objects and actions and is used to perform actions in response to user interaction operations.
[0016] In a second aspect, an embodiment of the present application provides a user interaction operation response device, which is applied to a UI control, and the device includes:
[0017] An acquisition module, used to acquire user interaction operations triggered by users on the user interface;
[0018] a determination module, configured to determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation;
[0019] A processing module is used to respond to the triggering of a target event, intercept the call and determine that the target event corresponds to a second object during the process of calling the first object, and the second object includes processing logic modification information corresponding to the target method; forward the processing logic modification information to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
[0020] Among them, optionally, the first object is a delegate object pre-configured for the UI control by defining a protocol or interface, or an object pre-configured for the UI control by setting objects and actions for executing actions in response to user interaction operations.
[0021] Optionally, the processing module is specifically used to, in the process of calling the first object through the first calling method, identify the method name of the first calling method; in response to identifying the method name of the first calling method, intercept the call and call the second object through the second calling method as the object corresponding to the target event.
[0022] Optionally, the processing module is further specifically configured to determine a corresponding relationship between the first object and the second object.
[0023] Optionally, the processing module is further specifically used to send calling information of the target method to the second object, so that the second object determines the first object containing the target method according to the corresponding relationship, and forwards the calling information and the processing logic modification information to the first object.
[0024] Optionally, the processing module is further specifically configured to determine, according to the method name of the target method, the processing logic modification information corresponding to the target method from the processing logic modification information corresponding to the multiple methods included in the second object.
[0025] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a communication interface; wherein a computer program is stored on the memory, and when the computer program is executed by the processor, the processor can at least implement the user interaction operation response method described in the first aspect.
[0026] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor of an electronic device, the processor can at least implement the user interaction operation response method described in the first aspect.
[0027] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising: a computer program or instructions, which, when executed by a processor of an electronic device, enables the processor to at least implement the user interaction operation response method described in the first aspect.
[0028] In the scheme provided by the embodiment of the present application, the first object and the target method in the first object refer to the objects and methods pre-set for the UI control to respond to the user interaction operation. When the user interaction operation triggers the corresponding target event, the UI control calls the first object to execute the target method, thereby realizing the response to the user interaction operation. When it is necessary to modify the processing logic of the target method (such as adding a custom processing logic) to generate a response to the user interaction operation, this scheme intercepts the call and determines that the target event corresponding to the user interaction operation corresponds to the second object during the process of the UI control calling the first object, and forwards the processing logic modification information corresponding to the target method to the first object through the second object, so that the first object modifies the processing logic of the target method according to the received processing logic modification information, and calls the target method modified by the processing logic to generate a response to the user interaction operation, that is, the modification of the processing logic of the target method in the first object is realized by intercepting the call of the first object. Since a first object may contain multiple target methods, the modification process of the processing logic of the target method can be simplified by intercepting the first object instead of intercepting the target method one by one in this scheme, and the processing efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1 A flowchart of a user interaction operation response method provided in an embodiment of the present application;
[0031] Figure 2 A schematic diagram of a scenario for modifying processing logic provided in an embodiment of the present application;
[0032] Figure 3 A schematic diagram of another scenario of processing logic modification provided in an embodiment of the present application;
[0033] Figure 4 A flowchart of another user interaction operation response method provided in an embodiment of the present application;
[0034] Figure 5A schematic diagram of the structure of a user interaction operation response device provided in an embodiment of the present application;
[0035] Figure 6 For Figure 5 A schematic diagram of the structure of an electronic device corresponding to the user interaction operation response device provided in the illustrated embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0037] It should be noted that, in the case where the embodiments of the present application involve user information, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse. In addition, the various models involved in this application (including but not limited to language models or large models) are in compliance with relevant laws and standards.
[0038] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0039] Before introducing the user interaction operation response method provided by the embodiment of the present invention, the related concepts involved in the embodiment of the present invention are briefly described.
[0040] User Interface Control (UI Control for short) refers to interactive elements or components in the user interface, such as buttons, text boxes, check boxes, drop-down lists, etc. UI controls are used for users to interact with applications. Specifically, they are used to obtain user interaction operations, execute corresponding processing logic, and finally display information to users to respond to user interaction operations.
[0041] User interaction refers to the interaction between a user and a UI control by clicking the mouse, pressing the keyboard, touching the screen, etc. For example, clicking a button, entering text in a text box, selecting a menu item, etc. are all common user interaction operations. User interaction triggers events on UI controls, and then executes certain logic processing corresponding to the events.
[0042] An event refers to an action or state change that occurs on a user interface. It is a bridge between user behavior and program response. Developers can define how to respond to user interactions through specific events.
[0043] An object is an entity in a programming language that contains data (also called attributes) and actions that can be performed on the data (also called methods). For example, an object may contain methods for responding to user interactions.
[0044] A method is a piece of code belonging to an object that defines the actions that the object can perform.
[0045] In the application scenarios of UI controls, objects and methods for responding to user interaction operations are usually pre-set for UI controls. When the user interaction operation triggers the corresponding event, the UI control calls the pre-set object and executes the method corresponding to the event, thereby responding to the user interaction operation, such as updating the displayed content, processing form submission, etc.
[0046] However, in actual applications, the method for responding to user interaction operations pre-configured for UI controls may not fully meet the user's interaction needs. Therefore, in some cases, it is necessary to modify the processing logic in the method for responding to user interaction operations, such as adding custom processing logic.
[0047] In the related art, a hook method is usually used to modify the processing logic in the method for responding to the user interaction operation. Specifically, the method for responding to the user interaction operation is first intercepted, and then the processing logic in the intercepted method is modified.
[0048] It is understandable that if you want to intercept a method, you need to know the method name of the method. However, in actual applications, the name of the method used to respond to user interaction operations is often customized, and the methods used to respond to user interaction operations involved in different user interfaces may be the same or different. If each method is identified and intercepted one by one based on the name of the method used to respond to user interaction operations, it will consume a lot of manpower and be inefficient.
[0049] For ease of understanding, for example, assume that there are 4 pages, and each page contains 4 UI controls, List A, List B, List C, and List D, wherein each UI control is pre-set with objects and methods for responding to user interaction operations. When it is necessary to modify the processing logic in the method for responding to user interaction operations, it is necessary to obtain the method name of the method corresponding to each UI control in each page, and configure the interception logic based on the method name. In the case where each UI control corresponds to at least one method for responding to user interaction operations, at least 16 method interception logics must be configured. When the number of pages, the number of UI controls involved in the pages, and the number of methods for responding to user interaction operations corresponding to the UI controls are large, the acquisition of the name of the method for responding to user interaction operations, the configuration of the interception logic, and the processing logic modification information will become more complicated and consume more manpower.
[0050] In order to solve at least one of the above technical problems and improve the efficiency of modifying the processing logic in the method for responding to user interaction operations, an embodiment of the present application provides a user interaction operation response method, the basic idea is: when it is necessary to modify the processing logic of the target method preset for responding to user interaction operations, in the process of the UI control calling the first object where the target method is located, intercept the call, and determine that the target event corresponding to the user interaction operation corresponds to the second object; then, forward the processing logic modification information corresponding to the target method to the first object through the second object, so that the first object modifies the processing logic of the target method according to the received processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation, that is, the modification of the processing logic of the target method in the first object is realized by intercepting the call of the first object. In this solution, since a first object may contain multiple target methods, this solution can simplify the modification process of the processing logic of the target method by intercepting the first object instead of intercepting the target method one by one, and improve the processing efficiency.
[0051] The user interaction operation response method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0052] The user interaction operation response method provided in the embodiment of the present application is applied to a UI control and can be executed by an electronic device that deploys a computer program corresponding to the UI control. The electronic device can be a terminal device such as a PC, a laptop, a smart phone, or a server. The server can be a physical server including an independent host, or a virtual server, or a cloud server or a server cluster.
[0053] Figure 1 A flowchart of a user interaction operation response method provided in an embodiment of the present application, such as Figure 1 As shown, the following steps may be included:
[0054] 101. Obtain a user interaction operation triggered by a user on a user interface.
[0055] 102. Determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation.
[0056] 103. In response to triggering of a target event, in the process of calling a first object, intercept the call and determine that the target event corresponds to a second object, wherein the second object includes processing logic modification information corresponding to the target method.
[0057] 104. Forward the processing logic modification information to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
[0058] In the specific implementation process, the UI control monitors the user interaction operations (such as clicks, slides, etc.) triggered by the user on the user interface, and triggers corresponding events when the user interaction operations occur. For example, when a click operation triggered by the user on the user interface is monitored, a click event is triggered; when a slide operation triggered by the user on the user interface is monitored, a slide event is triggered.
[0059] Optionally, user interaction operations corresponding to different events can be preset. In addition, objects and methods for responding to user interaction operations corresponding to different events can also be preset, that is, the objects and methods for responding to user interaction operations set for UI controls mentioned above.
[0060] In the embodiment of the present application, for the convenience of description, the event corresponding to the user interaction operation is referred to as the target event, and the object and method corresponding to the target event for responding to the user interaction operation are referred to as the first object and the target method, wherein the first object includes the target method. In other words, the first object is the object that is pre-set for the UI control and needs to be called when responding to the user interaction operation, and the target method in the first object is the method that is pre-set for the UI control and used to respond to the user interaction operation.
[0061] When there is no need to modify the processing logic of the target method, in response to the triggering of the target event, the UI control determines the first object corresponding to the target event, and the target method in the first object for responding to the user interaction operation; thereafter, the UI control calls the first object so that the first object calls the target method, thereby generating a response to the user interaction operation.
[0062] For situations where the processing logic of the target method needs to be modified, for ease of understanding, combined with Figure 2 and Figure 3 To illustrate with an example, Figure 2 A schematic diagram of a scenario for processing logic modification provided in an embodiment of the present application.
[0063] like Figure 2 As shown, in response to the triggering of the target event, the UI control first calls the first object; then, in the process of the first object calling the target method, based on the method name of the target method, the call is intercepted (i.e., the call of the first object to the target method is intercepted), and the processing logic in the target method is modified, such as: adding new processing logic to the target method, or modifying the execution order of the processing logic, etc.; finally, the target method with the modified processing logic is called by the first object to achieve a response to the user interaction operation corresponding to the target event.
[0064] but, Figure 2 The processing logic modification method shown is as described above. It is necessary to configure the interception logic and processing logic modification information for each target method separately. When the number of pages, the number of UI controls involved in the pages, and the number of methods corresponding to the UI controls for responding to user interaction operations are large, the configuration operation will become complicated, require more manpower, and be inefficient.
[0065] Based on this, the embodiment of the present application provides another way to modify the processing logic, such as Figure 3 As shown, Figure 3 A schematic diagram of another scenario of processing logic modification provided in an embodiment of the present application.
[0066] like Figure 3 As shown, in response to the triggering of the target event, in the process of the UI control calling the first object, the call is intercepted (i.e., the UI control's call to the first object is intercepted), and it is determined that the target event corresponds to the second object. Among them, the second object is pre-configured with processing logic modification information corresponding to a variety of different methods, and these processing logic modification information include processing logic modification information corresponding to the target method. Afterwards, the UI control calls the second object to forward the processing logic modification information of the target method to the first object through the second object. After receiving the processing logic modification information of the target method, the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to achieve a response to the user interaction operation corresponding to the target event.
[0067] Optionally, the processing logic modification information corresponding to the target method may be determined from the processing logic modification information corresponding to the multiple methods included in the second object according to the method name of the target method included in the first object.
[0068] It is easy to understand that when there is more than one target method contained in the first object, the interception of multiple different target methods in the first object can be achieved by configuring the corresponding interception logic for one first object, which can effectively simplify the configuration of the interception logic. Since the processing logic modification information contained in the second object is a collection of processing logic modification information corresponding to multiple different methods, when there are enough processing logic modification information corresponding to different methods contained in the second object, there is no need to configure separate processing logic modification information for each first object. Different first objects can use the same second object because the second object can contain processing logic modification information corresponding to target methods in different first objects, thereby effectively simplifying the configuration process of processing logic information. This solution can effectively reduce the difficulty of modifying the processing logic of the target method and improve the efficiency of modifying the processing logic of the target method by optimizing from two dimensions: the configuration of the interception logic and the configuration of the processing logic information.
[0069] In addition, it can be understood that when the second object stores the processing logic modification information corresponding to multiple different methods, if the processing logic modification information corresponding to the target method needs to be modified, it can be done by modifying the information stored in the second object, that is, only one modification is required. Figure 2 According to the method shown, if the interception logic and processing logic modification information are configured for the target method on different pages, when the processing logic modification information corresponding to the target method needs to be modified, the processing logic modification information corresponding to the target method on each page needs to be modified, that is, multiple modifications need to be made. Therefore, the solution provided by the embodiment of the present application can also improve the modification efficiency of the processing logic modification information corresponding to the target method, and correspondingly, can also improve the efficiency of modifying the processing logic corresponding to the target method.
[0070] The above is a description of the overall process of the user interaction operation response method provided in the embodiment of the present application. Among them, it includes the process of modifying the processing logic in the user interaction operation response method (such as Figure 3 The following is a summary of Figure 3 The corresponding processing logic modification process is explained in detail.
[0071] Figure 4 A flowchart of another user interaction operation response method provided in an embodiment of the present application, such as Figure 4 As shown, the following steps may be included:
[0072] 401. Obtain the user interaction operation triggered by the user on the user interface.
[0073] 402. Determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation.
[0074] 403. In response to the triggering of the target event, in the process of calling the first object through the first calling method, the method name of the first calling method is identified; in response to the identification of the method name of the first calling method, the call is intercepted and the second object is called through the second calling method as the object corresponding to the target event, and the second object includes the processing logic modification information corresponding to the target method.
[0075] 404. Determine the correspondence between the first object and the second object; send the call information of the target method to the second object, so that the second object determines the first object containing the target method according to the correspondence, and forwards the call information and the processing logic modification information to the first object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
[0076] The specific implementation process of step 401 and step 402 can refer to the above-mentioned embodiment, which will not be described in detail in this embodiment. The embodiment of this application focuses on the processing logic modification process corresponding to the target method.
[0077] In actual applications, when UI controls call different objects, they usually use corresponding calling methods to call each object. For ease of description, in the embodiments of the present application, the calling method used to call the first object is called the first calling method, and the calling method used to call the second object is called the second calling method.
[0078] Unlike the method name of the target method, which is usually customized, the method name of the first calling method is usually specific and not easy to change. Therefore, optionally, the interception of the UI control calling the first object can be implemented based on the method name of the first calling method.
[0079] In a specific implementation process, in response to the triggering of a target event, in the process of calling the first object through the first calling method, the method name of the first calling method can be identified. In response to identifying the method name of the first calling method, the call is intercepted (i.e., the call of the UI control to the first object is intercepted), and the second object is called through a pre-configured second calling method as the object corresponding to the target event.
[0080] From the perspective of the UI control, after the interception process, it still calls the object used to respond to the user interaction operation, but it actually calls the second object instead of the first object. In the case that the UI control calls the object used to respond to the user interaction operation, it further sends a call message to the called object (i.e., the second object) so that it calls the target method used to respond to the user interaction operation.
[0081] In the embodiment of the present application, the core function of the second object is to provide the processing logic modification information corresponding to different methods. In order to modify the processing logic of the target method in the first object and call the target method after the processing logic is modified, in the embodiment of the present application, after intercepting the call of the UI control to the first object, the corresponding relationship between the first object and the second object is further determined.
[0082] Therefore, after receiving the calling information sent by the UI control, the second object can determine the first object containing the target method based on the correspondence between the first object and the second object, and forward the calling information and the processing logic modification information to the first object, so that the first object can modify the processing logic of the target method according to the processing logic modification information, and call the target method after the processing logic is modified to generate a response to the user interaction operation.
[0083] Optionally, in order to implement the above forwarding function, the second object does not contain any target method for responding to user interaction operations. In the specific implementation process, after receiving the call information sent by the UI control, the second object first determines whether the second object contains the target method corresponding to the call information. If not, the first object containing the target method is determined based on the correspondence between the first object and the second object, and the call information and processing logic modification information are forwarded to the first object.
[0084] In summary, in the embodiments of the present application, since the method name of the first calling method is usually not easy to change, by identifying the method name of the first calling method to intercept the call of the UI control to the first object, the difficulty of interception can be effectively reduced, and the efficiency and accuracy of modifying the processing logic of the target method can be improved.
[0085] The following is an example of two specific application scenarios to illustrate the above user interaction operation response method.
[0086] In an optional embodiment, the first object is a delegate object that is pre-configured for the UI control by defining a protocol or an interface.
[0087] In actual applications, the delegate pattern can be used to configure the corresponding delegate object for the UI control, and the delegate object contains the target method for responding to user interaction operations. The delegate pattern is a design pattern that defines a protocol or interface that enables an object (i.e., UI control) to notify another object (i.e., delegate object) of an event and instruct the delegate object to respond to the event, such as calling the target method to respond to the target event corresponding to the user interaction operation.
[0088] In a scenario where the first object is a delegate object, the UI control listens to user interaction operations triggered by the user on the user interface, and triggers a corresponding target event when a user interaction operation occurs. In response to the triggering of the target event, the UI control determines the delegate object corresponding to the target event and the target method in the delegate object for responding to the user interaction operation based on pre-configuration.
[0089] Afterwards, if the processing logic of the target method needs to be modified, the method name of the first calling method can be identified in the process of calling the delegate object through the first calling method. In response to identifying the method name of the first calling method, the call is intercepted (i.e., the call of the UI control to the delegate object is intercepted), and the second object is called through the pre-configured second calling method as the actual delegate object corresponding to the target event, and the corresponding relationship between the delegate object (the original delegate object) and the second object (the actual delegate object) is determined.
[0090] After receiving the call information sent by the UI control, the second object determines the delegate object containing the target method based on the correspondence between the delegate object and the second object, and forwards the call information and processing logic modification information to the delegate object, so that the delegate object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
[0091] Among them, according to the correspondence between the delegate object and the second object, the delegate object containing the target method is determined, including: through a message search process, when the second object does not contain the target method corresponding to the call information, according to the correspondence between the delegate object and the second object, the delegate object containing the target method is determined, and the call information and processing logic modification information are forwarded to the delegate object.
[0092] In another optional embodiment, the first object is an object that is pre-configured for the UI control by setting objects and actions and is used to perform actions in response to user interaction operations.
[0093] In actual applications, the "addTarget(_:action:for:)" method can be used to configure the UI control with corresponding objects (ie, Target, i.e., the first object mentioned above) and actions (ie, action, i.e., the target method mentioned above) for responding to user interaction operations.
[0094] For example, take "addTarget: (id) target action: (SEL) action for ControlEvents: (UIControl Events) control Events" as an example, where id represents the id of the first object configured for the UI control to respond to user interaction operations, (SEL) action is the method name of the target method, and controlEvents (i.e. control events) specifies the target events that will trigger the call of the target method.
[0095] Assume that the first object currently configured for the UI control through the "addTarget(_:action:for:)" method is Target a, the target method is action b contained in Target a, Target a and action b are called under the target event, then in response to the triggering of the target event, the UI control determines the Target a corresponding to the target event based on the pre-configuration, and the action b in Target a used to respond to user interaction operations.
[0096] Afterwards, if the processing logic of action b needs to be modified, the method name of the first calling method can be identified during the process of calling Target a through the first calling method. In response to identifying the method name of the first calling method, the call is intercepted (i.e., the call of the UI control to Target a is intercepted), and the second object is called through the pre-configured second calling method as the actual Target a corresponding to the target event, and the corresponding relationship between Target a (the original Target) and the second object (the actual Target) is determined.
[0097] After receiving the calling information sent by the UI control, the second object determines Target a containing action b according to the corresponding relationship between Target a and the second object, and forwards the calling information and processing logic modification information to Target a, so that Target a modifies the processing logic of action b according to the processing logic modification information, and calls action b after the processing logic is modified to generate a response to the user interaction operation.
[0098] Among them, according to the correspondence between Target a and the second object, determining Targeta containing action b includes: through a message search process, when the second object does not contain action b corresponding to the call information, according to the correspondence between Target a and the second object, determining Target a containing action b, and forwarding the call information and processing logic modification information to Target a.
[0099] Among them, optionally, the message search process can be implemented through the forwardingTargetForSe lector method.
[0100] Based on the above example, in the embodiment of the present application, in the scenario where the processing logic of the target method needs to be modified, the second object acts as an intermediary and exists in the process of the UI object calling the first object. On the one hand, it is used to receive the call information sent by the UI control, and on the other hand, it is used to determine the processing logic modification information corresponding to the target method, and forward the call information and the processing logic modification information to the first object, so that it modifies the processing logic of the target method according to the processing logic modification information, and calls the target method with the modified processing logic to generate a response to the user interaction operation. By using the second object as an intermediary, the difficulty of modifying the processing logic of the target method can be effectively reduced, and the efficiency of modifying the processing logic of the target method can be improved.
[0101] The user interaction operation response device of one or more embodiments of the present application will be described in detail below. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.
[0102] Figure 5 A schematic diagram of a user interaction operation response device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the device includes: an acquisition module 11, a determination module 12, and a processing module 13.
[0103] An acquisition module 11 is used to acquire a user interaction operation triggered by a user on the user interface;
[0104] A determination module 12, configured to determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation;
[0105] The processing module 13 is used to intercept the call and determine that the target event corresponds to a second object in the process of calling the first object in response to the triggering of the target event, and the second object includes processing logic modification information corresponding to the target method; forward the processing logic modification information to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
[0106] Among them, optionally, the first object is a delegate object pre-configured for the UI control by defining a protocol or interface, or an object pre-configured for the UI control by setting objects and actions for executing actions in response to user interaction operations.
[0107] Optionally, the processing module 13 is specifically used to, in the process of calling the first object through the first calling method, identify the method name of the first calling method; in response to identifying the method name of the first calling method, intercept the call and call the second object through the second calling method as the object corresponding to the target event.
[0108] Optionally, the processing module 13 is further specifically configured to determine a corresponding relationship between the first object and the second object.
[0109] Optionally, the processing module 13 is further specifically used to send calling information of the target method to the second object, so that the second object determines the first object containing the target method according to the corresponding relationship, and forwards the calling information and the processing logic modification information to the first object.
[0110] Optionally, the processing module 13 is further specifically configured to determine, according to the method name of the target method, the processing logic modification information corresponding to the target method from the processing logic modification information corresponding to the multiple methods included in the second object.
[0111] Figure 5 The device shown can execute the steps introduced in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.
[0112] In one possible design, the above Figure 5 The structure of the user interaction operation response device shown can be implemented as an electronic device, such as Figure 6As shown, the electronic device may include: a memory 21, a processor 22, and a communication interface 23. The memory 21 stores a computer program, and when the computer program is executed by the processor 22, the processor 22 can at least implement the user interaction operation response method provided in the above embodiment.
[0113] The above-mentioned memory 21 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0114] Accordingly, the embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the processor is enabled to implement each step in the above method embodiment. Among them, the computer-readable storage medium includes volatile or non-volatile or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (Phase-change Random Access Memory, PRAM), static random access memory (SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), other types of random access memory (Random-Access Memory, RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (Digital Video Disc, DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transmission medium
[0115] Accordingly, the embodiment of the present application also provides a computer program product, which includes a computer program or an instruction. When the computer program or the instruction is executed by the processor, the processor is enabled to implement each step in the above method embodiment. It should be understood that each process or a combination of multiple processes in the above method flow can be implemented by a computer program or an instruction. In addition, these computer programs or instructions can be applied to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable user interactive operation response device, so that the processor of the general-purpose computer, the special-purpose computer, the embedded processor, or other programmable user interactive operation response device can be implemented as a device for implementing the corresponding functions in the above method embodiment.
[0116] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0117] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0118] Finally, it should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device that includes the elements.
[0119] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A user interaction operation response method, characterized in that: Applicable to UI controls, including: Get the user interaction operations triggered by the user on the user interface; Determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation; In response to triggering of a target event, in the process of calling the first object, intercepting the call and determining that the target event corresponds to a second object, wherein the second object includes processing logic modification information corresponding to the target method; The processing logic modification information is forwarded to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method with modified processing logic to generate a response to the user interaction operation.
2. The method according to claim 1, characterized in that In the process of calling the first object, intercepting the call and determining that the target event corresponds to the second object includes: In the process of calling the first object through the first calling method, identifying the method name of the first calling method; In response to identifying the method name of the first calling method, the call is intercepted and a second object is called through a second calling method as an object corresponding to the target event.
3. The method according to claim 2, characterized in that The method further comprises: A corresponding relationship between the first object and the second object is determined.
4. The method according to claim 3, characterized in that The forwarding the processing logic modification information to the first object through the second object includes: The calling information of the target method is sent to the second object, so that the second object determines the first object including the target method according to the corresponding relationship, and forwards the calling information and the processing logic modification information to the first object.
5. The method according to claim 1, characterized in that The method further comprises: According to the method name of the target method, the processing logic modification information corresponding to the target method is determined from the processing logic modification information corresponding to the multiple methods included in the second object.
6. The method according to any one of claims 1 to 5, characterized in that The first object is a delegate object that is pre-configured for the UI control by defining a protocol or an interface.
7. The method according to any one of claims 1 to 5, characterized in that The first object is an object that is pre-configured for the UI control by setting objects and actions and is used to execute actions in response to user interaction operations.
8. A user interactive operation response device, characterized in that: Applicable to UI controls, including: An acquisition module, used to acquire user interaction operations triggered by users on the user interface; a determination module, configured to determine a target event corresponding to the user interaction operation, a first object corresponding to the target event, and a target method in the first object for responding to the user interaction operation; A processing module is used to respond to the triggering of a target event, intercept the call and determine that the target event corresponds to a second object during the process of calling the first object, and the second object includes processing logic modification information corresponding to the target method; forward the processing logic modification information to the first object through the second object, so that the first object modifies the processing logic of the target method according to the processing logic modification information, and calls the target method after the processing logic is modified to generate a response to the user interaction operation.
9. An electronic device, characterized in that: include: A memory, a processor, and a communication interface; wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the user interaction operation response method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the processor is caused to execute the user interaction operation response method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
User interface production method and device, storage medium and computer equipment
CN112494940A
Information interaction method, system and device and storage medium
CN115982494A
Modifying system-defined user interface control functionality on a computing device
US10235216B1
Interface displaying method and apparatus, storage medium, and electronic device
US20240033630A1