Control method and device based on sliding gesture, electronic equipment and storage medium

By listening to the status parameters of the nested ScrollView, determining whether the external ScrollView (S1) or internal ScrollView (S2) should respond to the sliding gesture, solving the problem of sliding gesture conflict under the SwiftUI framework and achieving a better user interaction experience.

CN120029516APending Publication Date: 2025-05-23HUBEI CENTURY NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510140198.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-08
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

Under the SwiftUI framework, when multiple nested ScrollViews are processed, it is difficult to effectively manage who responds to the swipe gesture, resulting in sliding gesture conflicts.

Method used

By listening to the offsets of state parameters S1 and S2 of multi-layer nested ScrollView, it is determined based on different states that the external ScrollView (S1) or internal ScrollView (S2) should respond to the sliding gesture. The specific state includes: when the offset of S1 does not reach the preset value and the offset of S2 is 0, S1 response is used; when the offset of S1 reaches the preset value and the offset of S2 is not 0, S2 response is used.

Benefits of technology

Effectively manage the sliding gesture response of nested ScrollView in the SwiftUI framework, solve the problem of sliding gesture conflict in complex states, and improve the user interaction experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029516A_ABST
    Figure CN120029516A_ABST
Patent Text Reader

Abstract

The invention provides a control method and device based on a sliding gesture, electronic equipment and a storage medium. The method comprises the following steps: monitoring a state parameter of a multi-layer nested Scroll View; in response to a first touch operation triggered by a downward sliding gesture, determining the state of the current multi-layer nested Scroll View according to the monitored state parameter of the multi-layer nested Scroll View; if it is determined that the state of the multi-layer nested Scroll View is a first state, using S1 to respond to the first touch operation; and if it is determined that the state of the multi-layer nested Scroll View is a second state, using S2 to respond to the first touch operation, and using S2 to respond to the first touch operation. According to the method, the sliding gesture response of the nested Scroll View in the SwiftUI framework can be effectively managed, and the conflict problem of sliding gestures in a complex state is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a control method, device, electronic device, and storage medium based on a sliding gesture. Background Art

[0002] In modern mobile application development, complex user interface designs often require the use of multiple ScrollViews to implement content display and interaction. However, when multiple ScrollViews are nested, it becomes a tricky problem as to which one should respond to the sliding gesture.

[0003] Especially in the SwiftUI framework, there is an outer ScrollView (S1) that scrolls vertically and nests a VStack containing a top view (TopView), a paging tab (Segment), and a TabView with the style `.tabViewStyle(.page(indexDisplayMode:.never))`. Further inside the TabView, there is another ScrollView, namely the inner ScrollView (S2), and S2 has the same scrolling direction as S1. When scrolling in S2 and reaching its top, usually S2 still continues to respond; but the expected behavior is to switch to the scrolling of S1.

[0004] The problem with this structure is that when the user operates through a sliding gesture, whether to use S1 or S2 to respond, the current SwiftUI does not provide corresponding APIs to solve the sliding gesture conflict problem in such a complex state. Summary of the Invention

[0005] In view of this, the present application provides a control method, device, electronic device, and storage medium based on a sliding gesture, which can effectively manage the sliding gesture response of nested ScrollViews in the SwiftUI framework and solve the conflict problem of sliding gestures in a complex state.

[0006] To solve the above technical problems, the technical solution of the present application is implemented as follows: In one embodiment, a control method based on a sliding gesture is provided, and the method includes: Listening to the state parameters of multiple nested ScrollViews; wherein, the state parameters include the offset of S1 and the offset of S2; S1 is the outer ScrollView, and S2 is the inner ScrollView; In response to a first touch operation triggered by a downward sliding gesture, determining a current state of the multi-layer nested ScrollView according to a monitored state parameter of the multi-layer nested ScrollView; If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the first touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0; If it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the first touch operation, and use S2 to respond to the first touch operation; wherein, the second state is that the offset of S1 reaches the preset offset value, and the offset of S2 is not 0.

[0007] Wherein, the method further comprises: If it is determined that the state of the multi-layer nested ScrollView is the third state, S1 is reused to respond to the first touch operation; wherein the third state is that the offset of S1 reaches a preset offset value, and the offset of S2 is 0; If it is determined that the state of the multi-layer nested ScrollView is the fourth state, S2 is used to respond to the first touch operation; wherein, the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

[0008] Wherein, the method further comprises: In response to a second touch operation triggered by an upward sliding gesture, determining a current state of the multi-layer nested ScrollView according to a state parameter of the monitored multi-layer nested ScrollView; If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the second touch operation; If it is determined that the state of the multi-layer nested ScrollView is the second state, S2 is used to respond to the second touch operation.

[0009] Wherein, the method further comprises: If it is determined that the state of the multi-layer nested ScrollView is the third state, use S2 to respond to the second touch operation; If it is determined that the state of the multi-layer nested ScrollView is the fourth state, S1 is used to respond to the second touch operation.

[0010] Wherein, the method further comprises: TabView has multiple sub-pages, and the sliding states of S2 in different sub-pages are independent of each other.

[0011] Wherein, the method further comprises: Monitor subpage index; In response to the change of the sub-page index, the offset of S2 corresponding to the changed sub-page index is recalculated, and the current state of the multi-layer nested ScrollView is determined based on the newly calculated offset of S2.

[0012] In another embodiment, a control device based on a sliding gesture is provided, the device comprising: A monitoring unit, used to monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the external ScrollView, and S2 is the internal ScrollView; A determining unit, configured to determine a current state of the multi-layer nested ScrollView according to a monitored state parameter of the multi-layer nested ScrollView in response to a first touch operation triggered by a downward sliding gesture; A control unit, for responding to the first touch operation using S1 if it is determined that the state of the multi-layer nested ScrollView is a first state; wherein the first state is that the offset of S1 does not reach a preset offset value, and the offset of S2 is 0; and for responding to the first touch operation using S2 if it is determined that the state of the multi-layer nested ScrollView is a second state, and responding to the first touch operation using S2; wherein the second state is that the offset of S1 reaches a preset offset value, and the offset of S2 is not 0.

[0013] in, The control unit is further used to reuse S1 to respond to the first touch operation if it is determined that the state of the multi-layer nested ScrollView is the third state; wherein the third state is that the offset of S1 reaches a preset offset value, and the offset of S2 is 0; if it is determined that the state of the multi-layer nested ScrollView is the fourth state, use S2 to respond to the first touch operation; wherein the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

[0014] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a control method based on a sliding gesture when executing the program.

[0015] In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, a control method based on a sliding gesture is implemented.

[0016] As can be seen from the above technical solution, the above embodiment provides the offset of monitoring the state parameters S1 and S2 of the multi-layer nested ScrollView. When receiving the touch operation triggered by the sliding gesture, the state of the current multi-layer nested ScrollView is determined according to the state parameters of the currently monitored multi-layer nested ScrollView, and the response by S1 or S2 is determined according to the determined state of the multi-layer nested ScrollView and the specific touch operation. This solution can effectively manage the sliding gesture response of the nested ScrollView in the SwiftUI framework and solve the conflict problem of sliding gestures in complex states. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 This is a schematic diagram of a control flow based on a sliding gesture in an embodiment of the present application; Figure 2 This is a schematic diagram of a control flow based on a downward sliding gesture in an embodiment of the present application; Figure 3 This is a schematic diagram of a control flow based on an upward sliding gesture in an embodiment of the present application; Figure 4 This is a schematic diagram of a multi-layer nested ScrollView corresponding to the first state in an embodiment of the present application; Figure 5 This is a schematic diagram of a multi-layer nested ScrollView corresponding to the second state in an embodiment of the present application; Figure 6 This is a schematic diagram of a multi-layer nested ScrollView corresponding to the third state in an embodiment of the present application; Figure 7 This is a schematic diagram of a multi-layer nested ScrollView corresponding to the fourth state in an embodiment of the present application; Figure 8 A schematic diagram of a multi-layer nested ScrollView for selecting a sub-page index switch in an embodiment of the present application; Fig. 9 This is a schematic diagram of the structure of a control device based on sliding gestures in an embodiment of the present application; Fig.10 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 creative work are within the scope of protection of this application.

[0020] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe the order or precedence of the objects. It should be understood that the data used in this way can be interchanged where appropriate, so that the implementation of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0021] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0022] When multiple ScrollViews are nested, the sliding gesture is responded to by the outer ScrollView or the inner ScrollView. The relevant implementation does not give the expected implementation method, and thus fails to solve the conflict problem of sliding gestures in this complex state.

[0023] Based on the above problems, a control method based on sliding gesture is provided in the embodiment of the present application. By monitoring the offset of the state parameters S1 and S2 of the multi-layer nested ScrollView, when receiving the touch operation triggered by the sliding gesture, the state of the current multi-layer nested ScrollView is determined according to the state parameters of the currently monitored multi-layer nested ScrollView, and the response by S1 or S2 is determined according to the determined state of the multi-layer nested ScrollView and the specific touch operation. This solution can effectively manage the sliding gesture response of the nested ScrollView in the SwiftUI framework and solve the conflict problem of sliding gestures in complex states.

[0024] The following describes in detail the control process based on sliding gestures in the embodiments of the present application in conjunction with the accompanying drawings.

[0025] For the convenience of description below, `contentOffset.y` of S1 is set to the offset of S1 (S1.offsetY), and `contentOffset.y` of S2 is set to the offset of S2 (S2.offsetY).

[0026] See also Figure 1 , Figure 1 This is a schematic diagram of the control flow based on the sliding gesture in the embodiment of the present application. The specific steps are: Step 101, monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the outer ScrollView, and S2 is the inner ScrollView.

[0027] Step 102 : In response to a first touch operation triggered by a downward sliding gesture, determine a current state of the multi-layer nested ScrollView according to state parameters of the monitored multi-layer nested ScrollView.

[0028] Step 103: If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the first touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0. End this process.

[0029] Step 104, if it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the first touch operation, and use S2 to respond to the first touch operation; wherein, the second state is that the offset of S1 reaches a preset offset value, and the offset of S2 is not 0.

[0030] In this embodiment, by monitoring the offset of the state parameters S1 and S2 of the multi-layer nested ScrollView, when receiving a touch operation triggered by a sliding gesture, the state of the current multi-layer nested ScrollView is determined according to the state parameters of the currently monitored multi-layer nested ScrollView, and the response by S1 or S2 is determined according to the determined state of the multi-layer nested ScrollView and the specific touch operation. This solution can effectively manage the sliding gesture response of the nested ScrollView in the SwiftUI framework and solve the conflict problem of sliding gestures in complex states.

[0031] See also Figure 2 , Figure 2 This is a schematic diagram of the control flow based on the downward sliding gesture in the embodiment of the present application. The specific steps are: Step 201, monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the outer ScrollView, and S2 is the inner ScrollView.

[0032] Step 202 , in response to a first touch operation triggered by a downward sliding gesture, determine a current state of the multi-layer nested ScrollView according to state parameters of the monitored multi-layer nested ScrollView.

[0033] Step 203: If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the first touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0. End this process.

[0034] Step 204: if it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the first touch operation; wherein the second state is that the offset of S1 reaches the preset offset value, and the offset of S2 is not 0. End this process.

[0035] Step 205: if it is determined that the state of the multi-layer nested ScrollView is the third state, S1 is reused to respond to the first touch operation; wherein the third state is that the offset of S1 reaches a preset offset value and the offset of S2 is 0. This process ends.

[0036] Step 206, if it is determined that the state of the multi-layer nested ScrollView is the fourth state, use S2 to respond to the first touch operation; wherein the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

[0037] In this embodiment, by monitoring the offset of the state parameters S1 and S2 of the multi-layer nested ScrollView, when receiving a touch operation triggered by a sliding gesture, the state of the current multi-layer nested ScrollView is determined according to the state parameters of the currently monitored multi-layer nested ScrollView, and the response by S1 or S2 is determined according to the determined state of the multi-layer nested ScrollView and the specific touch operation. This solution can effectively manage the sliding gesture response of the nested ScrollView in the SwiftUI framework and solve the conflict problem of sliding gestures in complex states.

[0038] See also Figure 3 , Figure 3 This is a schematic diagram of the control flow based on the upward sliding gesture in the embodiment of the present application. The specific steps are: Step 301, monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the outer ScrollView, and S2 is the inner ScrollView.

[0039] Step 302 : In response to a second touch operation triggered by an upward sliding gesture, determine a current state of the multi-layer nested ScrollView according to state parameters of the monitored multi-layer nested ScrollView.

[0040] Step 303: If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the second touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0. This process ends.

[0041] Step 304: If it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the second touch operation; wherein the second state is that the offset of S1 reaches a preset offset value, and the offset of S2 is not 0. This process ends.

[0042] Step 305: If it is determined that the state of the multi-layer nested ScrollView is the third state, use S2 to respond to the second touch operation; wherein the third state is that the offset of S1 reaches the preset offset value, and the offset of S2 is 0. End this process.

[0043] Step 306, if it is determined that the state of the multi-layer nested ScrollView is the fourth state, use S1 to respond to the second touch operation; wherein the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

[0044] In this embodiment, by monitoring the offset of the state parameters S1 and S2 of the multi-layer nested ScrollView, when receiving a touch operation triggered by a sliding gesture, the state of the current multi-layer nested ScrollView is determined according to the state parameters of the currently monitored multi-layer nested ScrollView, and the response by S1 or S2 is determined according to the determined state of the multi-layer nested ScrollView and the specific touch operation. This solution can effectively manage the sliding gesture response of the nested ScrollView in the SwiftUI framework and solve the conflict problem of sliding gestures in complex states.

[0045] The response processes for sliding upward and sliding downward in the above four states are respectively given below in conjunction with the accompanying drawings.

[0046] See also Figure 4 , Figure 4Schematic diagram of the multi-layer nested ScrollView corresponding to the first state in the embodiments of the present application. Figure 4 The view corresponding to the first state of the multi-layer nested ScrollView is shown. At this time, the state parameter is that the offset of S1 has not reached the preset offset value, and the offset of S2 is 0. The fact that the offset of S1 has not reached the preset offset value indicates that the SegmentView is not floating, and the fact that the offset of S2 is 0 indicates that the content corresponding to S2 has reached the top, that is Figure 4 the first content c1 in the S2 part in

[0047] See Figure 5 , Figure 5 Schematic diagram of the multi-layer nested ScrollView corresponding to the second state in the embodiments of the present application. Figure 5 The view corresponding to the second state of the multi-layer nested ScrollView is shown. At this time, the state parameter is that the offset of S1 has reached the preset offset value, and the offset of S2 is not 0. The fact that the offset of S1 has reached the preset offset value indicates that the SegmentView is floating, and the fact that the offset of S2 is not 0 indicates that the content corresponding to S2 has not reached the top, that is Figure 5 the fifth content c5 in the S2 part in

[0048] See Figure 6 , Figure 6 Schematic diagram of the multi-layer nested ScrollView corresponding to the third state in the embodiments of the present application. Figure 6 The view corresponding to the second state of the multi-layer nested ScrollView is shown. At this time, the state parameter is that the offset of S1 has reached the preset offset value, and the offset of S2 is 0. The fact that the offset of S1 has reached the preset offset value indicates that the SegmentView is floating, and the fact that the offset of S2 is not 0 indicates that the content corresponding to S2 has reached the top, that is Figure 6 the first content c1 in the S2 part in

[0049] See Figure 7 , Figure 7 Schematic diagram of the multi-layer nested ScrollView corresponding to the fourth state in the embodiments of the present application. Figure 7The view corresponding to the fourth state of the multi-layer nested ScrollView is displayed. The state parameters at this time are that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0. The offset of S1 does not reach the preset offset value, which means that SegmentView is not suspended, and the offset of S2 is not 0, which means that the content corresponding to S2 has not reached the top, that is, Figure 7 In the S2 part, the content displayed at the top of S2 is c3, not the first content c1 of S2. At this time, the second touch operation triggered by the upward sliding gesture is responded by S1, and the first touch operation triggered by the downward sliding gesture is responded by S2.

[0050] TabView has multiple sub-pages, and the sliding states of S2 in different sub-pages are independent of each other. That is, different sub-pages can be switched through Segment. Every time you switch to a new sub-page, the S2 corresponding to the new sub-page is used to respond.

[0051] The process of independent control and response in S2 in each sub-page is as follows: Monitor subpage index; In response to the change of the sub-page index, the offset of S2 corresponding to the changed sub-page index is recalculated, and the state of the current multi-layer nested ScrollView is determined based on the newly calculated offset of S2.

[0052] See also Figure 8 , Figure 8 A schematic diagram of a multi-layer nested ScrollView for selecting a sub-page index to switch in an embodiment of the present application. Figure 8 The left view is the view before switching. In the displayed multi-layer nested ScrollView view state, you can see that the state of the corresponding multi-layer nested ScrollView is the fourth state (the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0). In this fourth state, the upward sliding gesture uses S1 to respond, and the downward sliding gesture is triggered and uses S2 to respond.

[0053] Now switch to the multi-layer nested ScrollView corresponding to subpage index 1 by reselecting it in the Paging tab. Figure 8 On the right side in the middle is the multi-layer nested ScrollView after selecting sub-page index 1 for switching in the embodiment of the present application. In the displayed multi-layer nested ScrollView view state, it can be seen that the state of the corresponding multi-layer nested ScrollView is the first state (the offset of S1 does not reach the preset offset value, and the offset of S2 is 0). In this first state, whether it is an upward sliding gesture or a downward sliding gesture, S1 is used to respond.

[0054] Figure 8The above is a case where SegmentView is not suspended. For the case where SegmentView is suspended, the offset of S2 is recalculated when switching sub-pages. When a sliding gesture triggers a touch operation, the current multi-layer nested ScrollView view state is determined based on the offsets of S1 and S2 to further determine whether S1 or S2 responds.

[0055] The above technical solution provided in the embodiment of the present application can be realized: in a VStack structure including TopView, Segment and TabView, the outer ScrollView (S1) and the inner ScrollView (S2) share the same sliding direction. When the user slides with an upward sliding gesture, the SegmentView will be suspended and fixed on the top of S1, and then the sliding response of S2 will be activated. When the offset of S2 reaches the top, sliding down will trigger the response of S1, causing the overall interface to roll back.

[0056] In a TabView that contains multiple subpages, the sliding gesture response of the ScrollView (S2) in each subpage is managed independently according to the subpage index. When switching subpages, the system recalculates the offset of S2 in real time to ensure that the gesture switching process between different pages is seamless and coherent.

[0057] The control method based on sliding gestures proposed in the embodiment of the present application successfully solves the technical problem of sliding gesture conflicts in the nested ScrollView structure by dynamically monitoring the offsets of S1 and S2 and rationally managing specific trigger gestures. The method is applicable to a variety of application scenarios of complex UI structures, especially in applications with multi-layer nested sliding views, and can significantly improve the user's interactive experience.

[0058] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0059] Based on the same inventive concept, the present application also provides a control device based on sliding gestures. Fig. 9 , Fig. 9 This is a schematic diagram of the structure of a control device based on sliding gestures in an embodiment of the present application. The device includes: The monitoring unit 901 is used to monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the external ScrollView, and S2 is the internal ScrollView; A determining unit 902 is configured to determine a state of a current multi-layer nested ScrollView according to a monitored state parameter of the multi-layer nested ScrollView in response to a first touch operation triggered by a downward sliding gesture; The control unit 903 is used to use S1 to respond to the first touch operation if it is determined that the state of the multi-layer nested ScrollView is the first state; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0; if it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the first touch operation, and use S2 to respond to the first touch operation; wherein the second state is that the offset of S1 reaches the preset offset value, and the offset of S2 is not 0.

[0060] In another embodiment, The control unit 903 is further used to reuse S1 to respond to the first touch operation if it is determined that the state of the multi-layer nested ScrollView is the third state; wherein the third state is that the offset of S1 reaches a preset offset value, and the offset of S2 is 0; if it is determined that the state of the multi-layer nested ScrollView is the fourth state, use S2 to respond to the first touch operation; wherein the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

[0061] In another embodiment, The determining unit 902 is further configured to determine the state of the current multi-layer nested ScrollView according to the monitored state parameters of the multi-layer nested ScrollView in response to the second touch operation triggered by the upward sliding gesture; The control unit 903 is further used to use S1 to respond to the second touch operation if it is determined that the state of the multi-layer nested ScrollView is the first state; use S2 to respond to the second touch operation if it is determined that the state of the multi-layer nested ScrollView is the second state; use S2 to respond to the second touch operation if it is determined that the state of the multi-layer nested ScrollView is the third state; and use S1 to respond to the second touch operation if it is determined that the state of the multi-layer nested ScrollView is the fourth state.

[0062] In another embodiment, TabView has multiple sub-pages, and the sliding states of S2 in different sub-pages are independent of each other.

[0063] In another embodiment, The monitoring unit 901 is further used to monitor the sub-page index; The determination unit 902 is further used to recalculate the offset of S2 corresponding to the changed sub-page index in response to the change of the sub-page index, and determine the state of the current multi-layer nested ScrollView based on the newly calculated offset of S2.

[0064] The units in the above-mentioned embodiments may be integrated into one body or deployed separately; they may be combined into one unit or further divided into multiple sub-units.

[0065] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a control method based on a sliding gesture when executing the program.

[0066] In another embodiment, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, a control method based on a sliding gesture is implemented.

[0067] Fig.10 Schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. Fig.10 As shown, the electronic device may include: a processor (Processor) 1010, a communication interface (Communications Interface) 1020, a memory (Memory) 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020, and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute the following method: Monitor the state parameters of multi-layer nested ScrollView; the state parameters include the offset of S1 and the offset of S2; S1 is the external ScrollView, and S2 is the internal ScrollView; In response to a first touch operation triggered by a downward sliding gesture, determining a state of a current multi-layer nested ScrollView according to a state parameter of the monitored multi-layer nested ScrollView; If it is determined that the state of the multi-layer nested ScrollView is the first state, S1 is used to respond to the first touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0; If it is determined that the state of the multi-layer nested ScrollView is the second state, S2 is used to respond to the first touch operation, and S2 is used to respond to the first touch operation; wherein, the second state is that the offset of S1 reaches the preset offset value, and the offset of S2 is not 0.

[0068] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0069] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0070] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0071] The flow chart and block diagram in the accompanying drawings of the present application show the possible architecture, function and operation of the system, method and computer program product according to the various embodiments disclosed in the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in the order of the standards in different figures. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0072] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims disclosed in this application may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application may be combined and / or combined in a variety of ways, and all of these combinations and / or combinations fall within the scope disclosed in this application.

[0073] Specific embodiments are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas, and is not used to limit the present application. For those skilled in the art, changes can be made in the specific implementation methods and application scopes according to the ideas, spirits and principles of the present invention, and any modifications, equivalent substitutions, improvements, etc. made therein should be included in the scope of protection of this application.

Claims

1. A control method based on sliding gesture, characterized in that: The method comprises: Monitor the state parameters of multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the external ScrollView, and S2 is the internal ScrollView; In response to a first touch operation triggered by a downward sliding gesture, determining a current state of the multi-layer nested ScrollView according to a monitored state parameter of the multi-layer nested ScrollView; If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the first touch operation; wherein the first state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is 0; If it is determined that the state of the multi-layer nested ScrollView is the second state, use S2 to respond to the first touch operation, and use S2 to respond to the first touch operation; wherein, the second state is that the offset of S1 reaches the preset offset value, and the offset of S2 is not 0.

2. The method according to claim 1, characterized in that The method further comprises: If it is determined that the state of the multi-layer nested ScrollView is the third state, S1 is reused to respond to the first touch operation; wherein the third state is that the offset of S1 reaches a preset offset value, and the offset of S2 is 0; If it is determined that the state of the multi-layer nested ScrollView is the fourth state, S2 is used to respond to the first touch operation; wherein, the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

3. The method according to claim 2, characterized in that The method further comprises: In response to a second touch operation triggered by an upward sliding gesture, determining a current state of the multi-layer nested ScrollView according to a state parameter of the monitored multi-layer nested ScrollView; If it is determined that the state of the multi-layer nested ScrollView is the first state, use S1 to respond to the second touch operation; If it is determined that the state of the multi-layer nested ScrollView is the second state, S2 is used to respond to the second touch operation.

4. The method according to claim 3, characterized in that The method further comprises: If it is determined that the state of the multi-layer nested ScrollView is the third state, use S2 to respond to the second touch operation; If it is determined that the state of the multi-layer nested ScrollView is the fourth state, S1 is used to respond to the second touch operation.

5. The method according to claim 1, characterized in that The method further comprises: TabView has multiple sub-pages, and the sliding states of S2 in different sub-pages are independent of each other.

6. The method according to claim 5, characterized in that The method further comprises: Monitor subpage index; In response to the change of the sub-page index, the offset of S2 corresponding to the changed sub-page index is recalculated, and the current state of the multi-layer nested ScrollView is determined based on the newly calculated offset of S2.

7. A control device based on sliding gestures, characterized in that: The device comprises: A monitoring unit, used to monitor the state parameters of the multi-layer nested ScrollView; wherein the state parameters include the offset of S1 and the offset of S2; S1 is the external ScrollView, and S2 is the internal ScrollView; A determining unit, configured to determine a current state of the multi-layer nested ScrollView according to a monitored state parameter of the multi-layer nested ScrollView in response to a first touch operation triggered by a downward sliding gesture; A control unit, for responding to the first touch operation using S1 if it is determined that the state of the multi-layer nested ScrollView is a first state; wherein the first state is that the offset of S1 does not reach a preset offset value, and the offset of S2 is 0; and for responding to the first touch operation using S2 if it is determined that the state of the multi-layer nested ScrollView is a second state, and responding to the first touch operation using S2; wherein the second state is that the offset of S1 reaches a preset offset value, and the offset of S2 is not 0.

8. The device according to claim 7, characterized in that The control unit is further used to reuse S1 to respond to the first touch operation if it is determined that the state of the multi-layer nested ScrollView is the third state; wherein the third state is that the offset of S1 reaches a preset offset value, and the offset of S2 is 0; if it is determined that the state of the multi-layer nested ScrollView is the fourth state, use S2 to respond to the first touch operation; wherein the fourth state is that the offset of S1 does not reach the preset offset value, and the offset of S2 is not 0; the preset offset value is the vertical length of the top view.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 6 is implemented.