CN108829331B - Monitoring processing method of sliding event and terminal equipment - Google Patents

Monitoring processing method of sliding event and terminal equipment Download PDF

Info

Publication number
CN108829331B
CN108829331B CN201810517156.5A CN201810517156A CN108829331B CN 108829331 B CN108829331 B CN 108829331B CN 201810517156 A CN201810517156 A CN 201810517156A CN 108829331 B CN108829331 B CN 108829331B
Authority
CN
China
Prior art keywords
sliding
touch screen
sliding operation
touch position
control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810517156.5A
Other languages
Chinese (zh)
Other versions
CN108829331A (en
Inventor
张亚鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN201810517156.5A priority Critical patent/CN108829331B/en
Publication of CN108829331A publication Critical patent/CN108829331A/en
Application granted granted Critical
Publication of CN108829331B publication Critical patent/CN108829331B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/0485Scrolling or panning

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a method for monitoring and processing a sliding event and a terminal device, wherein the method comprises the following steps: monitoring an initial touch position and a termination touch position of sliding operation on the touch screen; determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; the offset information comprises a moving direction and a moving distance of the sliding operation on the touch screen; and controlling the current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen. The monitoring processing method of the sliding event and the terminal equipment provided by the embodiment of the invention improve the monitoring flexibility of the sliding event.

Description

Monitoring processing method of sliding event and terminal equipment
Technical Field
The present invention relates to the technical field of terminal devices, and in particular, to a method for monitoring and processing a sliding event and a terminal device.
Background
With the continuous development of terminal devices, a user performs a sliding operation on a touch screen of the terminal device, for example, when browsing a web page or a photo, the user touches a sliding control (scrollview) on the terminal device with a finger to slide up or down, so as to browse the web page or the photo.
For the terminal device, before receiving a sliding operation of a user on a touch screen of the terminal device and displaying corresponding content according to the sliding operation, the system needs to set a sliding control first and monitor a sliding distance of the sliding control in an up-down direction, so as to trigger a page to slide according to the sliding distance to display the corresponding content to the user.
However, with the existing sliding event monitoring method, the page sliding can only be triggered according to the sliding distance of the sliding operation in the up-down direction to display the corresponding content to the user, and the page sliding cannot be triggered according to the offset of the sliding operation in other directions to display the corresponding content to the user, so that the flexibility of sliding event monitoring is not high.
Disclosure of Invention
The invention provides a monitoring processing method of a sliding event and terminal equipment, which are used for improving the monitoring flexibility of the sliding event.
The embodiment of the invention provides a monitoring processing method of a sliding event, which comprises the following steps:
monitoring an initial touch position and a termination touch position of sliding operation on the touch screen;
determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen;
and controlling a current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen.
In a possible implementation manner, before listening to an initial touch position and a termination touch position of a sliding operation on a touch screen, the method further includes:
and registering key value monitoring KVO in a sliding event monitoring classification corresponding to the sliding control.
In one possible implementation manner, the listening for an initial touch position and an end touch position of a sliding operation on a touch screen includes:
monitoring the content offset attribute contentOffSet of the sliding control scrollview through the KVO; the content bias attribute of the slide event is used for indicating the position change of the view;
and determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
In a possible implementation manner, the current display interface corresponds to a plurality of sliding controls, and the method further includes:
and for each sliding control, adding a corresponding callback Block attribute in the classification of the sliding control, wherein different sliding controls correspond to different callback Block attributes.
In one possible implementation, the method further includes:
and if the moving distance of any sliding control in the first direction is greater than a preset threshold value, triggering a callback block attribute of the sliding control to perform callback, and marking the first direction so as to trigger callback only once in the same direction.
In a possible implementation manner, the current display interface corresponds to a plurality of sliding controls, and the sliding operation of each sliding control is used to control the display of at least one display control on the current display interface.
In one possible implementation, the method further includes:
and if the moving direction of the sliding operation on the touch screen is changed, updating the initial touch position of the sliding operation on the touch screen.
An embodiment of the present invention further provides a terminal device, where the terminal device may include:
the monitoring unit is used for monitoring an initial touch position and a termination touch position of the sliding operation on the touch screen;
the processing unit is used for determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen;
and the control unit is used for controlling the current display page on the touch screen to carry out corresponding display according to the moving direction and the moving distance of the sliding operation on the touch screen.
In a possible implementation manner, the terminal device further includes:
and the registration unit is used for registering the key value monitoring KVO in the sliding event monitoring classification corresponding to the sliding control.
In a possible implementation manner, the monitoring unit is specifically configured to monitor a content offset attribute contentOffSet of the sliding control scrollview through the KVO; the content bias attribute of the slide event is used for indicating the position change of the view; and determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
In a possible implementation manner, the current display interface corresponds to a plurality of sliding controls, and the processing unit is further configured to add, for each sliding control, a corresponding callback Block attribute in the classification of the sliding control, where different sliding controls correspond to different callback Block attributes.
In a possible implementation manner, the processing unit is further configured to trigger a callback block attribute of the slide control to perform callback if a moving distance of any one of the slide controls in the first direction is greater than a preset threshold, and mark the first direction so that the callback is triggered only once in the same direction.
In a possible implementation manner, the current display interface corresponds to a plurality of sliding controls, and the sliding operation of each sliding control is used to control the display of at least one display control on the current display interface.
In a possible implementation manner, the terminal device further includes:
and the updating unit is used for updating the initial touch position of the sliding operation on the touch screen if the moving direction of the sliding operation on the touch screen changes.
The embodiment of the invention also provides a terminal device, which comprises a processor and a memory, wherein,
the memory is to store program instructions;
the processor is configured to read the program instructions in the memory, and execute the method for handling a sliding event in the foregoing embodiment according to the program instructions in the memory.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for monitoring a sliding event shown in any of the above embodiments is executed.
The embodiment of the invention provides a method for monitoring and processing a sliding event and a terminal device, which monitor an initial touch position and a termination touch position of a sliding operation on a touch screen; determining offset information of sliding operation on the touch screen according to the initial touch position and the termination touch position; the offset information comprises a moving direction and a moving distance of the sliding operation on the touch screen; and controlling the current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen. Therefore, in the embodiment of the present invention, the terminal device monitors the initial touch position and the end touch position of the sliding operation on the touch screen to determine the moving direction and the moving distance of the sliding operation on the touch screen, and then controls the currently displayed page on the touch screen to perform corresponding display according to the moving direction and the moving distance of the sliding operation on the touch screen.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic flowchart of a method for monitoring and processing a sliding event according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another method for monitoring and processing a sliding event according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another method for monitoring and processing a sliding event according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another terminal device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another terminal device according to an embodiment of the present invention.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the prior art, when the page is triggered to slide according to the sliding distance to display corresponding content to the user, the page can only be triggered to slide according to the sliding distance of the sliding operation in the vertical direction to display the corresponding content to the user, and the page cannot be triggered to slide according to the offset of the sliding operation in other directions to display the corresponding content to the user, so that the monitoring flexibility of the sliding event is not high. In order to improve the flexibility of monitoring the sliding event, the embodiment of the invention provides a method for monitoring and processing the sliding event, which monitors the initial touch position and the termination touch position of the sliding operation on a touch screen; determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; the offset information comprises a moving direction and a moving distance of the sliding operation on the touch screen; according to the moving direction and the moving distance of the sliding operation on the touch screen, the current display page on the touch screen is controlled to correspondingly display, so that the monitoring processing method of the sliding event, provided by the embodiment of the invention, is not like the prior art, only the page sliding can be triggered according to the sliding distance of the sliding operation in the vertical direction to display corresponding content to a user, but the page sliding can be triggered according to the sliding distances of the sliding operation in different directions to display corresponding content to the user, and therefore, the monitoring flexibility of the sliding event is improved.
The technical solution of the present invention and how to solve the above technical problems will be described in detail with specific examples. The following specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a method for monitoring a sliding event according to an embodiment of the present invention, please refer to fig. 1, where the method for monitoring a sliding event includes:
s101, monitoring an initial touch position and a termination touch position of a sliding operation on the touch screen.
The sliding operation refers to an operation caused by sliding of a finger of a user on the touch screen.
It should be noted that the initial touch position may be understood as a position where a user's finger is in contact with the touch screen before the sliding operation is performed; the touch position of the terminal can be understood as a position where the user's finger leaves the touch screen after the sliding operation is completed.
And S102, determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position.
Wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen.
After the initial touch position and the termination touch position of the sliding operation on the touch screen are monitored through the above S101, the moving direction and the moving distance of the sliding operation on the touch screen can be determined according to the initial touch position and the termination touch position.
For example, if the initial touch position of the sliding operation is (0, 0) and the end touch position is (4, 4), the moving direction of the sliding operation on the touch screen is determined as 45 ° sliding to the upper right, and the moving distance in the direction is determined as
Figure BDA0001673711270000064
Thereby determining the moving direction and the moving distance of the sliding operation on the touch screen.
S103, controlling a current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen.
After the moving direction and the moving distance of the sliding operation on the touch screen are determined through S102, the current display page on the touch screen can be controlled to be correspondingly displayed according to the moving direction and the moving distance of the sliding operation on the touch screen. For example, the corresponding relationship between the moving direction and the moving distance on the touch screen and the page display may be preset, so as to control the currently displayed page on the touch screen to perform corresponding display according to the moving direction and the moving distance on the touch screen and the corresponding relationship between the moving direction and the moving distance on the touch screen and the page display.
For example, if it is preset that the sliding operation is performed in a 45 ° sliding direction to the upper right, the moving distance in this direction is
Figure BDA0001673711270000061
Corresponding to the search box on the page being displayed as hidden, the sliding operation on the touch screen is determined to move 45 degrees to the upper right and the moving distance in the direction is
Figure BDA0001673711270000062
Thereafter, it is possible to directly slide at 45 ° to the upper right with respect to the moving direction in which the moving distance is
Figure BDA0001673711270000063
And determining a search frame on the hidden page, thereby controlling the current display page on the touch screen to be correspondingly displayed. And the page is not required to be triggered to slide according to the sliding distance of the sliding operation in the vertical direction to display corresponding content to the user, so that the page is triggered to slide according to the sliding distance of the sliding operation in different directions to display corresponding content to the user, and the monitoring flexibility of the sliding event is improved.
The embodiment of the invention provides a monitoring processing method of a sliding event, which monitors an initial touch position and a termination touch position of sliding operation on a touch screen; determining offset information of sliding operation on the touch screen according to the initial touch position and the termination touch position; the offset information comprises a moving direction and a moving distance of the sliding operation on the touch screen; and controlling the current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen. Therefore, in the embodiment of the present invention, the terminal device monitors the initial touch position and the end touch position of the sliding operation on the touch screen to determine the moving direction and the moving distance of the sliding operation on the touch screen, and then controls the currently displayed page on the touch screen to perform corresponding display according to the moving direction and the moving distance of the sliding operation on the touch screen.
Based on the embodiment shown in fig. 1, on the basis of the embodiment shown in fig. 1, further referring to fig. 2, fig. 2 is a schematic flow chart of another method for listening to a sliding event according to an embodiment of the present invention, where the method for listening to a sliding time may further include:
s201, register KVO (Key-value observer, Key value monitor) in the sliding event monitoring classification corresponding to the sliding control.
Before monitoring the initial touch position and the end touch position of the sliding operation on the touch screen in S101, it is necessary to register a key value to monitor KVO in a sliding event monitoring category corresponding to the sliding control so as to monitor the initial touch position and the end touch position of the sliding operation on the touch screen through the KVO.
When monitoring KVO by the register key, a sliding control scrollview category (SlidingEvent) may be added first, KVO monitoring is registered in a new interface in the category, an observer is added as a self scrollview, a monitored attribute is a content offset attribute contentOffset, and a monitored value is an offset of the sliding operation, so as to execute S202 below, which monitors the content offset attribute contentOffset set of the sliding control scrollview through KVO.
S202, monitoring the content offset attribute contentOffSet of the sliding control scrollview through the KVO.
Wherein the content bias attribute of the slide event is used to indicate a change in position of the view.
Illustratively, when monitoring the content offset attribute contentOffSet of the sliding control scrollview through KVO, the savePoint attribute may be set first, the contentOffSet value of the first callback triggered by the sliding control and the start contentOffSet value of the new direction at the moment of the change of the sliding direction are saved, two state attributes of isUpPointSaved and isDownPointSaved are set, and if the state is YES, storage is not performed, and if NO, storage is performed, so that savePoint is only stored once in one direction. In addition, it should be noted that, if the moving direction of the sliding operation on the touch screen changes, the initial touch position of the sliding operation on the touch screen is updated, so as to ensure that the new savePoint can be updated in time when the moving direction changes.
S203, determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
The user slides a finger or slides the touch control scrollview, the corresponding slide control scrollview slides up and down, the offset of the sliding operation is determined according to the up and down sliding of the slide control scrollview, the callback is triggered according to the offset change, and the initial touch position and the final touch position of the contentOffset are analyzed in the callback process. For example, newPoint may be used to refer to an initial touch position of a callback return, and oldPoint may be used to refer to an ending touch position of the callback return, so as to determine the initial touch position and the ending touch position of the sliding operation on the touch screen according to the monitored content offset attribute contentOffSet.
Specifically, when the slidable direction of the slide control scrollview is determined, if the initial touch position and the end touch position satisfy the condition newpoint.y > oldpoint.y, it is determined that the sliding operation is the upward sliding operation, at this time, isdownpointsave may be set to NO, and isuppointsave may be updated to YES.
In contrast, if the initial touch position and the end touch position satisfy the condition newpoint.y < oldpoint.y, it is determined that the sliding operation is a downward sliding operation, and at this time, isdownpoint saved may be set YES and isuppoint saved may be updated NO.
And S204, determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position.
Wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen.
After the initial touch position and the end touch position of the sliding operation on the touch screen are determined according to the listened content offset attribute contentOffSet through the above S203, the moving direction and the moving distance of the sliding operation on the touch screen can be determined according to the initial touch position and the end touch position.
For example, if the initial touch position of the sliding operation is (0, 0) and the end touch position is (4, 4), the moving direction of the sliding operation on the touch screen is determined as 45 ° sliding to the upper right, and the moving distance in the direction is determined as
Figure BDA0001673711270000081
Thereby determining the moving direction and the moving distance of the sliding operation on the touch screen.
And S205, controlling the current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen.
After the moving direction and the moving distance of the sliding operation on the touch screen are determined through the above S204, the current display page on the touch screen can be controlled to be correspondingly displayed according to the moving direction and the moving distance of the sliding operation on the touch screen. For example, the corresponding relationship between the moving direction and the moving distance on the touch screen and the page display may be preset, so as to control the currently displayed page on the touch screen to perform corresponding display according to the moving direction and the moving distance on the touch screen and the corresponding relationship between the moving direction and the moving distance on the touch screen and the page display.
For example, if it is preset that the sliding operation is performed in a 45 ° sliding direction to the upper right, the moving distance in this direction is
Figure BDA0001673711270000091
Corresponding to the search box on the page being displayed as hidden, the sliding operation on the touch screen is determined to move 45 degrees to the upper right and the moving distance in the direction is
Figure BDA0001673711270000092
Thereafter, it is possible to directly slide at 45 ° to the upper right with respect to the moving direction in which the moving distance is
Figure BDA0001673711270000093
And determining a search frame on the hidden page, thereby controlling the current display page on the touch screen to be correspondingly displayed. The page sliding can be triggered only according to the sliding distance of the sliding operation in the up-and-down direction to display corresponding content to the user, and the fact that the corresponding content is not displayed according to the sliding operation is achievedThe sliding distance in the same direction triggers the page sliding to display corresponding content to the user, so that the flexibility of sliding event monitoring is improved.
The above S202 to S204 describe how to trigger the page to slide according to the sliding distance of the sliding operation in different directions to display the corresponding content to the user when there is one sliding control, and then, if the current display interface corresponds to multiple sliding controls, it needs to be explained that the current display interface corresponds to multiple sliding controls, and the sliding operation of each sliding control is used to control the display of at least one display control on the current display interface. For example, a sliding control that slides up and down is arranged on the current display interface, the corresponding sliding operation is whether to hide the search box at the top of the webpage, when the sliding control slides up, the search box at the top of the webpage is hidden, and when the sliding control slides down, the search box at the top of the webpage is not hidden; a sliding control element that slides left and right is further provided, the corresponding sliding operation is to determine whether to display various selection setting pages, when sliding left, the various selection setting pages are not displayed, and when sliding right, the various selection setting pages are displayed, please refer to fig. 3, which is a schematic flow diagram of another method for monitoring and processing a sliding event according to an embodiment of the present invention, where the method for monitoring and processing a sliding event may further include:
s301, for each sliding control, adding a corresponding callback Block attribute in the classification of the sliding control.
And different sliding controls correspond to different callback Block attributes.
It should be noted that different sliding controls correspond to different callback Block attributes, that is, for each sliding control, a unique callback Block attribute is correspondingly set, so that when callback Block attributes are called in the subsequent execution according to the sliding operation, the callback Block attributes corresponding to the sliding controls can be called in a one-to-one correspondence manner, and therefore, the sliding operation of which sliding control cannot be judged when a plurality of sliding controls correspond to one callback Block attribute is avoided.
The method comprises the following steps of exemplarily, when a corresponding callback Block attribute is added in the classification of the sliding control, introducing a # import header file into a class which needs to use the callback Block attribute for use, and specifically:
// registering a watcher, sliding up in the direction of "1" and triggering a condition to recall time
[sel.scrollV registerKvoObserverWithDirection:1conditionY:40];
// slide Up callback Block
sel.scrollV.callUpBack=^(id str){
NSLog (@ "Block callback ═ ═ @, @ str);
};
and S302, if the moving distance of any sliding control in the first direction is greater than a preset threshold, triggering a callback block attribute of the sliding control to perform callback, and marking the first direction so as to trigger the callback only once in the same direction.
When a KVO observer mode is adopted and the offset of the scrollview is obtained by monitoring the contentOffSet attribute of the sliding control scrollview through the KVO, the difference value of the initial touch position and the termination touch position can be compared, the displacement of the finger of the user on the x axis or the y axis is obtained to judge the moving direction and the moving distance of the finger, and the result is called back to the calling end as the condition for triggering the sliding event.
Illustratively, the callback is completed in the form of a callback Block, sliding up is CallBackUpBlock, sliding down is CallBackDownBlock, the callback Block exists in the form of an attribute, and the callback Block is called back at a certain timing, where an external incoming condition is required, where the condition is an offset floating point type condition. Specifically, the absolute value of (newpoint.y-self.savepoint.y) can be calculated and compared with the condition conditionY, a corresponding Block callback is triggered when the condition is met, and in order to ensure that the callback is triggered only once by sliding in the same direction, the attributes of two callback states are set: upBlockDo and downBlockDo. Wherein, upBlockDo initial value is NO, after the callback takes place, set the value of upBlockDo to YES to guarantee to trigger only one in a direction, when the direction of sliding changes and slides downwards, update upBlockDo's value to NO, guarantee to trigger Block callback again when the direction changes and satisfies the condition to slide upwards. Similarly, the initial value of the downblockDo is also NO, after the callback occurs, the value of the downblockDo is set to YES, and it is also ensured that only one is triggered in one direction, when the sliding direction changes and is upward, the value of the downblockDo is updated to NO, so that the callback Block callback is triggered again when the direction changes to be gliding and the condition is met, and therefore, when a plurality of sliding controls are provided, how to trigger the callback Block corresponding to the sliding control to carry out callback according to the determination of each sliding control can be realized, when the callback Block attribute is called according to the subsequent sliding operation, the callback Block attributes corresponding to the sliding controls can be called one by one, and therefore, the sliding operation of which sliding control can not be judged when the plurality of sliding controls correspond to one callback Block attribute can be avoided.
Fig. 4 is a schematic structural diagram of a terminal device 40 according to an embodiment of the present invention, please refer to fig. 4, where the terminal device 40 may include:
a listening unit 401 for listening an initial touch position and a terminal touch position of a sliding operation on the touch screen.
A processing unit 402, configured to determine offset information of a sliding operation on the touch screen according to the initial touch position and the termination touch position; wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen.
And a control unit 403, configured to control a current display page on the touch screen to perform corresponding display according to the moving direction and the moving distance of the sliding operation on the touch screen.
Optionally, the terminal device 40 may further include a registration unit 404, please refer to fig. 5, where fig. 5 is a schematic structural diagram of another terminal device 40 according to an embodiment of the present invention.
A registering unit 404, configured to register the key value listening KVO in the sliding event listening classification corresponding to the sliding control.
Optionally, the monitoring unit 401 is specifically configured to monitor a content offset attribute contentOffSet of the sliding control scrollview through the KVO; the content bias attribute of the slide event is used to indicate a change in position of the view; and determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
Optionally, the current display interface corresponds to multiple sliding controls, and the processing unit 402 is further configured to add, for each sliding control, a corresponding callback Block attribute in the classification of the sliding control, where different sliding controls correspond to different callback Block attributes.
Optionally, the processing unit 402 is further configured to trigger a callback block attribute of any one of the sliding controls to perform callback if the moving distance of the sliding control in the first direction is greater than a preset threshold, and mark the first direction so that the callback is triggered only once in the same direction.
Optionally, the current display interface corresponds to a plurality of sliding controls, and the sliding operation of each sliding control is used to control the display of at least one display control on the current display interface.
Optionally, the terminal device 40 may further include an updating unit 405.
An updating unit 405, configured to update an initial touch position of the sliding operation on the touch screen if a moving direction of the sliding operation on the touch screen changes.
The terminal device 40 shown in the embodiment of the present invention may execute the technical solution of the method for monitoring and processing a sliding event shown in any one of the above embodiments, and the implementation principle and the beneficial effects are similar, which are not described herein again.
Fig. 6 is a schematic structural diagram of another terminal device 60 according to an embodiment of the present invention, please refer to fig. 6, where the terminal device 60 may include a processor 601 and a memory 602, where,
the memory 602 is used to store program instructions.
The processor 601 is configured to read the program instructions in the memory 602 and execute the method for handling snooping of a sliding event according to any of the embodiments described above according to the program instructions in the memory 602.
The terminal device 60 shown in the embodiment of the present invention may execute the technical solution of the method for monitoring and processing a sliding event shown in any one of the above embodiments, and the implementation principle and the beneficial effect are similar, which are not described herein again.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for monitoring and processing a sliding event shown in any of the above embodiments is executed.
The processor in the above embodiments may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off the shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules may be located in a Random Access Memory (RAM), a flash memory, a read-only memory (ROM), a programmable ROM, an electrically erasable programmable memory, a register, or other storage media that are well known in the art. The storage medium is located in a memory, and a processor reads instructions in the memory and combines hardware thereof to complete the steps of the method.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A method for listening and processing a sliding event is characterized by comprising the following steps:
monitoring an initial touch position and a termination touch position of sliding operation on the touch screen;
determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen;
controlling a current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen;
the method further comprises the following steps: and if the moving direction of the sliding operation on the touch screen is changed, updating the initial touch position of the sliding operation on the touch screen.
2. The method of claim 1, wherein the listening for the initial touch position and the terminating touch position of the sliding operation on the touch screen is preceded by:
and registering key value monitoring KVO in a sliding event monitoring classification corresponding to the sliding control.
3. The method of claim 2, wherein listening for an initial touch position and an end touch position of a sliding operation on the touch screen comprises:
monitoring the content offset attribute contentOffSet of the sliding control scrollview through the KVO; the content bias attribute of the slide event is used for indicating the position change of the view;
and determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
4. The method of any of claims 1-3, wherein the current display interface corresponds to a plurality of slider controls, the method further comprising:
and for each sliding control, adding a corresponding callback Block attribute in the classification of the sliding control, wherein different sliding controls correspond to different callback Block attributes.
5. The method of claim 4, further comprising:
and if the moving distance of any sliding control in the first direction is greater than a preset threshold value, triggering a callback block attribute of the sliding control to perform callback, and marking the first direction so as to trigger callback only once in the same direction.
6. The method according to claim 4, wherein the current display interface corresponds to a plurality of sliding controls, and the sliding operation of each sliding control is used for controlling the display of at least one display control on the current display interface.
7. A terminal device, comprising:
the monitoring unit is used for monitoring an initial touch position and a termination touch position of the sliding operation on the touch screen;
the processing unit is used for determining offset information of the sliding operation on the touch screen according to the initial touch position and the termination touch position; wherein the offset information includes a moving direction and a moving distance of the sliding operation on the touch screen;
the control unit is used for controlling a current display page on the touch screen to correspondingly display according to the moving direction and the moving distance of the sliding operation on the touch screen;
the terminal device further includes:
and the updating unit is used for updating the initial touch position of the sliding operation on the touch screen if the moving direction of the sliding operation on the touch screen changes.
8. The apparatus of claim 7, further comprising:
and the registration unit is used for registering the key value monitoring KVO in the sliding event monitoring classification corresponding to the sliding control.
9. The apparatus of claim 8,
the monitoring unit is specifically configured to monitor the content offset attribute contentOffSet of the sliding control scrollview through the KVO; the content bias attribute of the slide event is used for indicating the position change of the view; and determining an initial touch position and a termination touch position of the sliding operation on the touch screen according to the monitored content bias attribute contentOffSet.
10. The device according to any one of claims 7 to 9, wherein the current display interface corresponds to a plurality of sliding controls, and the processing unit is further configured to add, for each sliding control, a corresponding callback Block attribute in the classification of the sliding control, where different sliding controls correspond to different callback Block attributes.
11. The apparatus of claim 10,
and the processing unit is further configured to trigger a callback block attribute of the sliding control to perform callback if the moving distance of any sliding control in the first direction is greater than a preset threshold, and mark the first direction so that callback is triggered only once in the same direction.
12. The device of claim 10, wherein the current display interface corresponds to a plurality of sliding controls, and the sliding operation of each sliding control is used to control the display of at least one display control on the current display interface.
13. A terminal device, comprising a processor and a memory, wherein,
the memory is to store program instructions;
the processor is used for reading the program instructions in the memory and executing the method for monitoring the sliding event according to any one of claims 1 to 6 according to the program instructions in the memory.
14. A computer-readable storage medium, characterized in that,
the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the method for snoop handling of a slip event as set forth in any of claims 1 to 6.
CN201810517156.5A 2018-05-25 2018-05-25 Monitoring processing method of sliding event and terminal equipment Active CN108829331B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810517156.5A CN108829331B (en) 2018-05-25 2018-05-25 Monitoring processing method of sliding event and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810517156.5A CN108829331B (en) 2018-05-25 2018-05-25 Monitoring processing method of sliding event and terminal equipment

Publications (2)

Publication Number Publication Date
CN108829331A CN108829331A (en) 2018-11-16
CN108829331B true CN108829331B (en) 2022-01-14

Family

ID=64145635

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810517156.5A Active CN108829331B (en) 2018-05-25 2018-05-25 Monitoring processing method of sliding event and terminal equipment

Country Status (1)

Country Link
CN (1) CN108829331B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109656557B (en) * 2018-12-19 2022-08-05 北京像素软件科技股份有限公司 User interface generation method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530047A (en) * 2012-07-06 2014-01-22 百度在线网络技术(北京)有限公司 Event triggering method and device of touch screen device
CN105094627A (en) * 2015-07-13 2015-11-25 北京金山安全软件有限公司 Browser page control method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ES2719086T3 (en) * 2013-03-07 2019-07-08 Tencent Tech Shenzhen Co Ltd Switching view mode of graphical user interface

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530047A (en) * 2012-07-06 2014-01-22 百度在线网络技术(北京)有限公司 Event triggering method and device of touch screen device
CN105094627A (en) * 2015-07-13 2015-11-25 北京金山安全软件有限公司 Browser page control method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ios监听ScrollView/TableView滚动的正确姿势;孙富有(iOS工程师);《博客园》;20170103;全文 *
react-native ScrollView触摸与滚动事件;神奇的小猴子;《CSDN博客》;20170829;全文 *

Also Published As

Publication number Publication date
CN108829331A (en) 2018-11-16

Similar Documents

Publication Publication Date Title
US20200192536A1 (en) Method for Performing Operation on Touchscreen and Terminal
US20160202887A1 (en) Method for managing application icon and terminal
CN108874289B (en) Application history record viewing method and device and electronic equipment
US9501215B2 (en) Image display device, image display control method, program and information storage medium
CA2922060C (en) Swipe toolbar to switch tabs
CN110362225B (en) Touch screen sampling frequency control method and device, medium and electronic equipment
US20120056832A1 (en) Information processing device, information processing method, and information processing program
CN110716906B (en) File viewing method, electronic equipment and file viewing device
US20150378965A1 (en) Method And Device For Text Input And Display Of Intelligent Terminal
CN107704157B (en) Multi-screen interface operation method and device and storage medium
CN104992094A (en) Terminal operation method and terminal
US20140075290A1 (en) Window switching method and apparatus
CN103309560A (en) Multi-interface information display method and terminal
CN104063125B (en) A kind of desktop icon management method and device
CN113835585A (en) Application interface switching method, device and equipment based on navigation and storage medium
CN107256116B (en) Page switching processing method and device, user terminal and readable storage medium
CN112083858A (en) Method and device for adjusting display position of control
CN108829331B (en) Monitoring processing method of sliding event and terminal equipment
CN105389105A (en) Method and system for moving application function interface, and mobile device
CN113204401B (en) Browser rendering method, terminal and storage medium
CN111158788A (en) Desktop starter control method and device and storage medium
EP3043251A1 (en) Method of displaying content and electronic device implementing same
CN104536692A (en) Operation method of touch screen, touch device and touch terminal
CN109246468B (en) Video list switching method, device and storage medium based on education system
CN112987992B (en) Navigation element display method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant