UIView instance navigation method, device, medium and program product

Through the navigation method of the UIView instance, the UIView interface switching is directly implemented, which solves the problem that the UIView cannot navigate in the existing technology, provides flexible animation methods and routing stack management, and improves the control efficiency of the UIView instance.

CN113886729BActive Publication Date: 2025-09-26KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110955409.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-19
Publication Date
2025-09-26
Estimated Expiration
2041-08-19

AI Technical Summary

Technical Problem

The existing technology cannot directly implement navigation of UIView instances. The UIView interface must be switched through navigation of UIViewController instances, which makes it impossible to implement navigation of simple UIView elements.

Method used

Provides a navigation method for UIView instances. It determines whether the trigger operation is a push or pop operation by receiving the trigger operation, obtains the upper or lower UIView instance according to the operation, and directly jumps and returns to the UIView instance, including animation methods and routing stack management.

Benefits of technology

It implements direct interface switching of UIView instances without navigating through UIViewController instances. It provides flexible and diverse animation methods, synchronizes routing stack states, and improves the control and management efficiency of UIView instances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886729B_ABST
    Figure CN113886729B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, medium, and program product for navigating a UIView instance. The method includes: receiving a trigger operation for a currently displayed UIView instance, determining whether the trigger operation is a push operation or a pop operation; if it is a push operation, obtaining an upper-level UIView instance to be redirected according to the push operation, and adding the upper-level UIView instance to the currently displayed UIView instance; if it is a pop operation, obtaining a lower-level UIView instance to be returned according to the pop operation, removing other UIView instances covering the lower-level UIView instance, and thereby displaying the lower-level UIView instance. The present invention implements redirection of the upper-level UIView instance and return of the lower-level UIView instance, and implements UIView interface switching directly through navigation of the UIView instance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a navigation method, device, medium and program product for a UIView instance. Background Art

[0002] UINavigationController inherits from UIViewController and is used to display content with a distinct hierarchical structure, presenting hierarchical content to users more efficiently. UINavigationController uses a UIViewController to display specific content in each hierarchy. UINavigationController is a container view controller that displays the content of multiple UIViewControllers. The UINavigationController's view consists of three parts: the UINavigationBar at the top, the toolbar at the bottom (which is hidden by default), and the UIView (view) of the UIViewController in the middle.

[0003] The native navigation solution of terminal operating systems (such as iOS) relies on UINavigationController and uses its Push and Pop operations to implement route jumps. The objects pushed and popped by UINavigationController are UIViewController instances. Therefore, using native navigation requires two prerequisites: the top element of the stack must be a UINavigationController instance, and the object received by Push and Pop operations must be a UIViewController instance. Therefore, the native navigation solution of terminal operating systems can only implement UIViewController navigation and cannot implement navigation of UIView elements alone.

[0004] Figure 2 This is a schematic diagram of a horizontally placed Pad interface. The right side of the button is the UIView of the UIViewController. The existing technology can only achieve interface switching of the UIView of the UIViewController by navigating the UIViewController instance, and cannot directly achieve navigation of the middle part UIView (view object). Figure 2 In the example, S1 represents the area corresponding to the UIView instance, and S2 represents the area corresponding to the UIViewController instance. Summary of the Invention

[0005] In response to the problems existing in the prior art, the present invention provides a navigation method, device, medium and program product for a UIView instance.

[0006] The present invention provides a navigation method for a UIView instance, comprising: receiving a trigger operation for a currently displayed UIView instance, and determining whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to an upper-layer UIView instance, and the pop operation indicates a return to a lower-layer UIView instance; if it is known that the trigger operation is the push operation, then obtaining the upper-layer UIView instance to be jumped to according to the push operation, and adding the upper-layer UIView instance to the currently displayed UIView instance; if it is known that the trigger operation is the pop operation, then obtaining the lower-layer UIView instance to be returned to according to the pop operation, removing other UIView instances covering the lower-layer UIView instance, thereby displaying the lower-layer UIView instance.

[0007] According to a navigation method for a UIView instance provided by the present invention, after adding the upper-layer UIView instance to the currently displayed UIView instance, the method further includes: appending the upper-layer UIView instance to the routing stack; after removing other UIView instances covering the lower-layer UIView instance, the method further includes: removing other UIView instances covering the lower-layer UIView instance from the routing stack.

[0008] According to a navigation method for a UIView instance provided by the present invention, the UIView instance is assigned an instance serial number; obtaining the lower-level UIView instance that needs to be returned according to the pop operation specifically includes: judging whether the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned; if so, obtaining the corresponding UIView instance according to the instance serial number as the lower-level UIView instance that needs to be returned; if not, querying the routing stack and taking the previous UIView instance of the currently displayed UIView instance that was pushed onto the stack earlier as the lower-level UIView instance that needs to be returned.

[0009] According to a navigation method for a UIView instance provided by the present invention, adding the upper-layer UIView instance to the currently displayed UIView instance specifically includes: obtaining the frame attribute of the underlying UIView instance, the frame attribute including the position and size of the UIView instance; and adding the upper-layer UIView instance to the currently displayed UIView instance according to the frame attribute.

[0010] According to a navigation method of a UIView instance provided by the present invention, the adding of the upper UIView instance to the currently displayed UIView instance specifically includes: if the push operation carries an animation mode, then adding the upper UIView instance to the currently displayed UIView instance according to the animation mode carried by the push operation; if the push operation does not carry an animation mode, then adding the upper UIView instance to the currently displayed UIView instance in a default animation mode; the removing of other UIView instances covering the lower UIView instance specifically includes: if the pop operation carries an animation mode, then removing other UIView instances covering the lower UIView instance according to the animation mode carried by the pop operation; if the pop operation does not carry an animation mode, then removing other UIView instances covering the lower UIView instance in a default animation mode; wherein, the animation mode includes at least one of left to right, right to left, top to bottom, and bottom to top.

[0011] According to a navigation method for a UIView instance provided by the present invention, the animation method carried by the push operation is used to add the upper UIView instance to the currently displayed UIView instance, specifically including: if the animation method is from left to right, the upper UIView instance is placed to the left of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a left to right animation; if the animation method is from right to left, the upper UIView instance is placed to the right of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a right to left animation. If the animation mode is from top to bottom, the upper UIView instance is placed directly above the currently displayed UIView instance, and a top-down animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance; if the animation mode is from bottom to top, the upper UIView instance is placed directly below the currently displayed UIView instance, and a bottom-up animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance; after the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0012] According to a navigation method for a UIView instance provided by the present invention, the animation method carried by the pop operation is used to remove other UIView instances covering the lower UIView instance, specifically including: if the animation method is from left to right, then the animation from right to left is used to remove other UIView instances covering the lower UIView instance; if the animation method is from right to left, then the animation from left to right is used to remove other UIView instances covering the lower UIView instance; if the animation method is from top to bottom, then the animation from bottom to top is used to remove other UIView instances covering the lower UIView instance; if the animation method is from bottom to top, then the animation from top to bottom is used to remove other UIView instances covering the lower UIView instance; after the animation ends, the other UIView instances covering the lower UIView instance are removed by the removeFromSuperView method.

[0013] The present invention also provides a navigation device for a UIView instance, comprising: a trigger operation receiving and judging module, used to: receive a trigger operation for a currently displayed UIView instance, and judge whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to an upper-layer UIView instance, and the pop operation indicates a return to a lower-layer UIView instance; a push operation processing module, used to: if it is known that the trigger operation is the push operation, obtain the upper-layer UIView instance to be jumped according to the push operation, and add the upper-layer UIView instance to the currently displayed UIView instance; a pop operation processing module, used to: if it is known that the trigger operation is the pop operation, obtain the lower-layer UIView instance to be returned according to the pop operation, remove other UIView instances covering the lower-layer UIView instance, thereby displaying the lower-layer UIView instance.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the navigation method of any of the above-mentioned UIView instances are implemented.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described methods for navigating a UIView instance.

[0016] The present invention also provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of any of the above-described methods for navigating a UIView instance.

[0017] The navigation method, device, medium and program product of UIView instance provided by the present invention achieve the jump of the upper-level UIView instance and the return of the lower-level UIView instance by obtaining the upper-level UIView instance to be jumped to and adding the upper-level UIView instance to the currently displayed UIView instance when receiving a push trigger operation, and obtaining the lower-level UIView instance to be returned and removing other UIView instances covering the lower-level UIView instance when receiving a pop trigger operation. There is no need to realize the interface switching of UIView of UIViewController through navigation of UIViewController instance, but the interface switching of UIView is realized directly through navigation of UIView instance. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 It is a flowchart of the navigation method of the UIView instance provided by the present invention;

[0020] Figure 2 It is a schematic diagram of a horizontally placed Pad interface display;

[0021] Figure 3 This is a schematic diagram of an animation process in the navigation method of the UIView instance provided by the present invention;

[0022] Figure 4 It is a structural diagram of the navigation device of the UIView instance provided by the present invention;

[0023] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0024] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0025] The following combination Figure 1-Figure 5 The present invention describes a navigation method, device, medium, and program product for a UIView instance.

[0026] Figure 1 This is a flow chart of the navigation method of the UIView instance provided by the present invention. Figure 1 As shown, the method includes:

[0027] Step 101: Receive a trigger operation for the currently displayed UIView instance, and determine whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates jumping to the upper UIView instance, and the pop operation indicates returning to the lower UIView instance.

[0028] There are two types of triggering operations for UIView instances: push and pop. A push operation indicates jumping to the upper-level UIView instance, while a pop operation indicates returning to the lower-level UIView instance. The upper-level UIView instance is displayed over the lower-level UIView instance. To display the lower-level UIView instance, the upper-level UIView instance must be removed.

[0029] The rules for determining whether to push or pop an operation can be pre-set. For example, you can refer to common mobile terminal operations and jump to the corresponding upper-level UIView instance for display when a button is clicked. When the back button is clicked or other set operations are performed, the display returns to the lower-level UIView instance.

[0030] Step 102: If it is known that the trigger operation is the push operation, the upper-layer UIView instance to be jumped to is obtained according to the push operation, and the upper-layer UIView instance is added to the currently displayed UIView instance.

[0031] If it is known that the trigger operation is a push operation, the upper-level UIView instance that needs to be jumped is obtained according to the push operation. For example, the upper-level UIView instance that needs to be jumped is obtained by determining which button is triggered, and then the obtained upper-level UIView instance is added to the currently displayed UIView instance, thereby jumping to the upper-level UIView instance for display.

[0032] Step 103: If it is known that the trigger operation is the pop operation, the lower-layer UIView instance to be returned is obtained according to the pop operation, and other UIView instances covering the lower-layer UIView instance are removed, so as to display the lower-layer UIView instance.

[0033] If the triggering operation is a pop operation, the underlying UIView instance to be returned is obtained according to the pop operation. For example, if the "Back" operation button is clicked, it means returning to the previous level. The pop operation mode of returning to the underlying UIView instance or other underlying UIView instances can also be set. In this way, the underlying UIView instance to be returned can be obtained through the received pop operation. After obtaining the underlying UIView instance to be returned, other UIView instances covering the underlying UIView instance are removed to display the underlying UIView instance.

[0034] The navigation method of UIView instance provided by the present invention realizes the jump of upper-layer UIView instance and the return of lower-layer UIView instance by obtaining the upper-layer UIView instance to be jumped when receiving the trigger operation of push, adding the upper-layer UIView instance to the currently displayed UIView instance, and obtaining the lower-layer UIView instance to be returned when receiving the trigger operation of pop, removing other UIView instances covering the lower-layer UIView instance, thereby realizing the jump of upper-layer UIView instance and the return of lower-layer UIView instance. There is no need to realize the interface switching of UIView of UIViewController through navigation of UIViewController instance, but the interface switching of UIView is realized directly through navigation of UIView instance.

[0035] According to a navigation method for a UIView instance provided by the present invention, after adding the upper-layer UIView instance to the currently displayed UIView instance, the method further includes: appending the upper-layer UIView instance to the routing stack; after removing other UIView instances covering the lower-layer UIView instance, the method further includes: removing other UIView instances covering the lower-layer UIView instance from the routing stack.

[0036] UIView is a rectangular area displayed on the screen, and it plays an important role in the App. For a UIView in a rectangular area, you can set up multiple levels of UIView instances, which constitute a UIView instance collection. The UIView instance collection includes the bottom UIView instance, as well as other UIView instances that increase in level, until the top UIView instance. For a UIView in a rectangular area, its UIView instance collection corresponds to a routing stack, which adopts a first-in-last-out mode.

[0037] After adding the upper UIView instance to the currently displayed UIView instance, the upper UIView instance is appended to the routing stack; and after removing other UIView instances covering the lower UIView instance, the other UIView instances covering the lower UIView instance are removed from the routing stack. This ensures that the UIView instances in the routing stack and the UIView instance currently displayed on the screen have the same state. For example, if the currently displayed UIView instance covers m lower UIView instances, the top of the routing stack is the currently displayed UIView instance, and inside it are m lower UIView instances that are stacked in sequence, among which the lower UIView instance is stacked first.

[0038] The navigation method of UIView instance provided by the present invention ensures synchronization of the display status of the routing stack and the current screen UIView instance by appending the upper UIView instance to the routing stack after adding the upper UIView instance to the currently displayed UIView instance; and after removing other UIView instances covering the lower UIView instance, removing other UIView instances covering the lower UIView instance from the routing stack, which is beneficial to the control and management of UIView instances.

[0039] According to a navigation method for a UIView instance provided by the present invention, the UIView instance is assigned an instance serial number; obtaining the lower-level UIView instance that needs to be returned according to the pop operation specifically includes: judging whether the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned; if so, obtaining the corresponding UIView instance according to the instance serial number as the lower-level UIView instance that needs to be returned; if not, querying the routing stack and taking the previous UIView instance of the currently displayed UIView instance that was pushed onto the stack earlier as the lower-level UIView instance that needs to be returned.

[0040] To make it easier to distinguish UIView instances, you can assign an instance number to each UIView instance. The instance number can be incremented starting from the bottom UIView instance according to the view hierarchy.

[0041] The pop operation can be set so that the pop operation process carries or does not carry the instance serial number of the lower-level UIView instance to be returned. Therefore, when obtaining the lower-level UIView instance to be returned according to the pop operation, determine whether the push operation carries the instance serial number of the lower-level UIView instance to be returned. If so, obtain the corresponding UIView instance as the lower-level UIView instance to be returned based on the instance serial number; remove other UIView instances covering the lower-level UIView instance to be returned, so as to display the lower-level UIView instance. At the same time, remove other UIView instances covering the lower-level UIView instance to be returned from the routing stack.

[0042] If not, query the routing stack and use the previous UIView instance of the currently displayed UIView instance that was pushed onto the stack earlier as the lower-level UIView instance that needs to be returned. That is, if the pop operation does not carry the instance number of the lower-level UIView instance that needs to be returned, return to the previous UIView instance. On the screen, remove the currently displayed UIView instance to display the previous UIView instance. In the routing stack, the currently displayed UIView instance is stored at the top of the stack. Remove the currently displayed UIView instance at the top of the stack from the routing stack, so that the previous UIView instance is at the top of the stack.

[0043] The UIView instance navigation method provided by the present invention improves the flexibility and speed of pop operation processing by obtaining the lower-level UIView instance to be returned according to the instance serial number when the pop operation carries the instance serial number, and using the previous UIView instance as the lower-level UIView instance to be returned when the pop operation does not carry the instance serial number.

[0044] According to a navigation method for a UIView instance provided by the present invention, adding the upper-layer UIView instance to the currently displayed UIView instance specifically includes: obtaining the frame attribute of the underlying UIView instance, the frame attribute including the position and size of the UIView instance; and adding the upper-layer UIView instance to the currently displayed UIView instance according to the frame attribute.

[0045] Because UIView is displayed in a rectangular area with a position and size. In order to achieve orderly display, when adding the upper UIView instance to the currently displayed UIView instance, the display position and size need to be clear, so that the upper UIView instance can be covered on the currently displayed UIView instance. For a certain rectangular area, in the set of UIView instances consisting of the bottom UIView instance to the top UIView instance, the size and position of each UIView instance when displayed can be the same. Therefore, for simplicity, the frame property of the bottom UIView instance can be set, and setting the frame property of the bottom UIView instance includes setting the position and size of the bottom UIView instance. When adding the upper UIView instance to the currently displayed UIView instance, obtain the position and size in the frame property of the bottom UIView instance, and add the upper UIView instance to the currently displayed UIView instance according to the frame property, thereby achieving the overlay display of the UIView instance.

[0046] The navigation method of the UIView instance provided by the present invention obtains the frame attribute of the underlying UIView instance and adds the upper UIView instance to the currently displayed UIView instance according to the frame attribute, thereby ensuring the orderly display of the UIView instance.

[0047] According to a navigation method of a UIView instance provided by the present invention, the adding of the upper UIView instance to the currently displayed UIView instance specifically includes: if the push operation carries an animation mode, then adding the upper UIView instance to the currently displayed UIView instance according to the animation mode carried by the push operation; if the push operation does not carry an animation mode, then adding the upper UIView instance to the currently displayed UIView instance in a default animation mode; the removing of other UIView instances covering the lower UIView instance specifically includes: if the pop operation carries an animation mode, then removing other UIView instances covering the lower UIView instance according to the animation mode carried by the pop operation; if the pop operation does not carry an animation mode, then removing other UIView instances covering the lower UIView instance in a default animation mode; wherein, the animation mode includes at least one of left to right, right to left, top to bottom, and bottom to top.

[0048] You can set the animation method for adding the upper UIView instance to the currently displayed UIView instance, as well as the animation method for removing other UIView instances that are covered by the lower UIView instance. If the animation method is not set, the default animation method can be used.

[0049] When adding the upper-level UIView instance to the currently displayed UIView instance, if the push operation carries an animation method, the upper-level UIView instance is added to the currently displayed UIView instance according to the animation method carried by the push operation; if the push operation does not carry an animation method, the upper-level UIView instance is added to the currently displayed UIView instance with the default animation method.

[0050] When removing other UIView instances covering the underlying UIView instance, if the pop operation carries an animation method, the other UIView instances covering the underlying UIView instance are removed according to the animation method carried by the pop operation; if the pop operation does not carry an animation method, the other UIView instances covering the underlying UIView instance are removed with the default animation method.

[0051] The animation mode can be any one of left to right, right to left, top to bottom, and bottom to top.

[0052] The navigation method of the UIView instance provided by the present invention sets the animation mode from left to right, from right to left, from top to bottom, and from bottom to top, and adds or removes the UIView instance according to the set animation mode. When the animation mode is not set, the default animation mode is adopted to realize the customization of the animation mode, thereby ensuring the diversity and flexibility of the animation mode during the addition and removal of the UIView instance.

[0053] According to a navigation method for a UIView instance provided by the present invention, the animation method carried by the push operation is used to add the upper UIView instance to the currently displayed UIView instance, specifically including: if the animation method is from left to right, the upper UIView instance is placed to the left of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a left to right animation; if the animation method is from right to left, the upper UIView instance is placed to the right of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a right to left animation. If the animation mode is from top to bottom, the upper UIView instance is placed directly above the currently displayed UIView instance, and a top-down animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance; if the animation mode is from bottom to top, the upper UIView instance is placed directly below the currently displayed UIView instance, and a bottom-up animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance; after the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0054] If the animation mode is from left to right, the upper UIView instance is placed to the left of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a left to right animation. After the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0055] If the animation mode is from right to left, the upper UIView instance is placed to the right of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a right-to-left animation. After the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0056] If the animation mode is from top to bottom, the upper UIView instance is placed directly above the currently displayed UIView instance, and a top-down animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance. After the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0057] If the animation method is from bottom to top, the upper UIView instance is placed directly below the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a bottom-up animation. After the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

[0058] When using the corresponding animation method to move the upper UIView instance, set the movement parameters according to the position and size of the underlying UIView instance so that the upper UIView instance moves to overlap with the currently displayed UIView instance. After the animation ends, use the addsubview method to add the upper UIView instance to the currently displayed UIView instance, thereby implementing the constraint relationship between the upper UIView instance and the currently displayed UIView instance at the display level.

[0059] The navigation method of the UIView instance provided by the present invention improves the reliability of adding the upper-layer UIView instance to the currently displayed UIView instance using various animation methods by providing specific methods for adding the upper-layer UIView instance to the currently displayed UIView instance in animation methods from left to right, from right to left, from top to bottom, and from bottom to top.

[0060] The present invention provides a navigation method for a UIView instance, which removes other UIView instances covering the lower UIView instance according to the animation method carried by the pop operation, specifically including: if the animation method is from left to right, then using a right to left animation to remove other UIView instances covering the lower UIView instance; if the animation method is from right to left, then using a left to right animation to remove other UIView instances covering the lower UIView instance; if the animation method is from top to bottom, then using a bottom-up animation to remove other UIView instances covering the lower UIView instance; if the animation method is from bottom to top, then using a top-down animation to remove other UIView instances covering the lower UIView instance; after the animation ends, the other UIView instances covering the lower UIView instance are removed by the removeFromSuperView method.

[0061] Since adding and removing UIView instances are similar to the "reverse process", from a visual experience perspective, the animations for adding and removing UIView views should also be opposite. For example, if a left-to-right animation is used to add a UIView view, a right-to-left animation can be used to remove the UIView view. If a right-to-left animation is used to add a UIView view, a left-to-right animation can be used to remove the UIView view. If a top-to-bottom animation is used to add a UIView view, a bottom-to-top animation can be used to remove the UIView view. If a bottom-to-top animation is used to add a UIView view, a top-to-bottom animation can be used to remove the UIView view.

[0062] For simplicity, the settings for animation modes can all refer to the animation mode when adding UIView views. Therefore, if the animation mode carried by the pop operation is from left to right, then the animation from right to left is used to remove other UIView instances covering the lower UIView instance; if the animation mode carried by the pop operation is from right to left, then the animation from left to right is used to remove other UIView instances covering the lower UIView instance; if the animation mode carried by the pop operation is from top to bottom, then the animation from bottom to top is used to remove other UIView instances covering the lower UIView instance; if the animation mode carried by the pop operation is from bottom to top, then the animation from top to bottom is used to remove other UIView instances covering the lower UIView instance. After the animation ends, the other UIView instances covering the lower UIView instance are removed through the removeFromSuperView method, thereby releasing the constraint relationship between the lower UIView instance and the other UIView instances above it in the display hierarchy.

[0063] The navigation method of the UIView instance provided by the present invention improves the reliability of removing other UIView instances covering the lower UIView instance by using various animation methods by providing specific methods for removing other UIView instances covering the lower UIView instance respectively from left to right, from right to left, from top to bottom, and from bottom to top.

[0064] Figure 3 This is a schematic diagram of an animation process in the navigation method of the UIView instance provided by the present invention. Figure 3 , further illustrating the process of the navigation method of the UIView instance provided by the present invention through specific examples.

[0065] First, you need to create a Category for UIView and implement two methods: Push and Pop. The Push method accepts two parameters: the UIView to be returned and the animation method. The Pop method accepts two parameters: the index of the UIView to be returned (if not passed, it defaults to the previous one) and the animation method.

[0066] Create a protocol with two properties: one of type UIView and one of type NSMutableArray. This protocol will be implemented by the instance that needs to be redirected. The UIView property is the underlying UIView for the Push operation, which is the basis for the Push redirect. The NSMutableArray property is a routing stack that stores the UIView instances used in Push and Pop operations. Elements in this data are added or removed during Push and Pop operations.

[0067] Create an animation class that inherits from NSObject and implements 4 methods: left to right, right to left, top to bottom, and bottom to top. Figure 3 As shown, the specific implementation is described using animation from right to left:

[0068] Place the arriveView directly to the right of the fromView and use a right-to-left animation to move the arriveView until it overlaps with the fromView. After the animation is complete, add the arriveView to the fromView using addSubview and append the arriveView instance to the fromView's routing stack NSMutableArray.

[0069] For the same reason as the right-to-left Pop, the upper UIView is moved to the right side of the underlying UIView through animation. After the animation is completed, the upper UIView is removed through the removeFromSuperView method and the upper UIView is removed from the routing stack.

[0070] The specific implementation of Push:

[0071] The Push method has two parameters: 1. Which UIView to push to; 2. The specific animation of the push.

[0072] First, get the underlying UIView (View property in the Protocol) through the created Protocol. The underlying UIView requires the caller to initialize it in advance and give it a frame property. At this time, get arriveView and fromView, and give the two UIviews to the animation method to implement the jump into the queue operation.

[0073] The specific implementation of Pop:

[0074] The Pop method has two parameters: 1. The sequence number of the UIView to be returned in the stack (if not filled in, the previous one is the default); 2. The specific animation of Pop.

[0075] First, get the UIView that needs to be Popped through the first parameter, and call the animation back to the UIView.

[0076] The navigation method of the UIView instance provided by the present invention can implement Push and Pop operations within a UIView of a specified custom frame on the screen, so as to achieve Push and Pop in any specified area. The code is simple and easy to read; the jump animation in any way can be customized, solving the problem that the native animation mode is single and the animation cannot be customized.

[0077] The navigation device of the UIView instance provided by the present invention is described below. The navigation device of the UIView instance described below and the navigation method of the UIView instance described above can correspond to each other.

[0078] Figure 4 It is a structural diagram of the navigation device of the UIView instance provided by the present invention. Figure 4 As shown, the device includes a trigger operation receiving and judging module 10, a push operation processing module 20 and a pop operation processing module 30, wherein: the trigger operation receiving and judging module 10 is used to: receive a trigger operation for the currently displayed UIView instance, and judge whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to the upper-level UIView instance, and the pop operation indicates a return to the lower-level UIView instance; the push operation processing module 20 is used to: if it is known that the trigger operation is the push operation, then according to the push operation, obtain the upper-level UIView instance to be jumped, and add the upper-level UIView instance to the currently displayed UIView instance; the pop operation processing module 30 is used to: if it is known that the trigger operation is the pop operation, then according to the pop operation, obtain the lower-level UIView instance to be returned, remove other UIView instances covering the lower-level UIView instance, thereby displaying the lower-level UIView instance.

[0079] The navigation device of UIView instance provided by the present invention obtains the upper-level UIView instance to be jumped when receiving a push trigger operation, adds the upper-level UIView instance to the currently displayed UIView instance, and obtains the lower-level UIView instance to be returned when receiving a pop trigger operation, removes other UIView instances covering the lower-level UIView instance, thereby realizing the jump of the upper-level UIView instance and the return of the lower-level UIView instance. There is no need to realize the interface switching of UIView of UIViewController through navigation of UIViewController instance, but directly realizes the navigation interface switching of UIView instance through navigation of UIView instance.

[0080] According to a navigation device of a UIView instance provided by the present invention, the push operation processing module 20 is used to add the upper-layer UIView instance to the currently displayed UIView instance, and is also used to: append the upper-layer UIView instance to the routing stack; the pop operation processing module 30 is used to remove other UIView instances covering the lower-layer UIView instance, and is also used to: remove other UIView instances covering the lower-layer UIView instance from the routing stack.

[0081] The navigation device of UIView instance provided by the present invention ensures synchronization of the display status of the routing stack and the UIView instance on the current screen by appending the upper-layer UIView instance to the routing stack after adding the upper-layer UIView instance to the currently displayed UIView instance; and after removing other UIView instances covering the lower-layer UIView instance, removing other UIView instances covering the lower-layer UIView instance from the routing stack, thereby facilitating the control and management of UIView instances.

[0082] According to a navigation device of a UIView instance provided by the present invention, the UIView instance is assigned an instance serial number; when the pop operation processing module 30 is used to obtain the lower-level UIView instance that needs to be returned according to the pop operation, it is specifically used to: determine whether the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned; if so, obtain the corresponding UIView instance according to the instance serial number as the lower-level UIView instance that needs to be returned; if not, query the routing stack and use the previous UIView instance of the currently displayed UIView instance that was pushed into the stack earlier as the lower-level UIView instance that needs to be returned.

[0083] The navigation device of the UIView instance provided by the present invention improves the flexibility and speed of pop operation processing by obtaining the lower-level UIView instance that needs to be returned according to the instance serial number when the pop operation carries the instance serial number, and using the previous UIView instance as the lower-level UIView instance that needs to be returned when the pop operation does not carry the instance serial number.

[0084] According to a navigation device of a UIView instance provided by the present invention, the push operation processing module 20, when used to add the upper-layer UIView instance to the currently displayed UIView instance, is specifically used to: obtain the frame attribute of the underlying UIView instance, the frame attribute including the position and size of the UIView instance; and add the upper-layer UIView instance to the currently displayed UIView instance according to the frame attribute.

[0085] The navigation device of the UIView instance provided by the present invention obtains the frame attribute of the bottom UIView instance and adds the upper UIView instance to the currently displayed UIView instance according to the frame attribute, thereby ensuring the orderly display of the UIView instance.

[0086] According to a navigation device of a UIView instance provided by the present invention, the push operation processing module 20, when used to add the upper-layer UIView instance to the currently displayed UIView instance, is specifically used to: if the push operation carries an animation mode, then the upper-layer UIView instance is added to the currently displayed UIView instance according to the animation mode carried by the push operation; if the push operation does not carry an animation mode, then the upper-layer UIView instance is added to the currently displayed UIView instance in a default animation mode; the pop operation processing module 30, when used to remove other UIView instances covering the lower-layer UIView instance, is specifically used to: if the pop operation carries an animation mode, then the other UIView instances covering the lower-layer UIView instance are removed according to the animation mode carried by the pop operation; if the pop operation does not carry an animation mode, then the other UIView instances covering the lower-layer UIView instance are removed in a default animation mode; wherein the animation mode includes at least one of from left to right, from right to left, from top to bottom, and from bottom to top.

[0087] The navigation device of the UIView instance provided by the present invention sets the animation mode from left to right, from right to left, from top to bottom, and from bottom to top, and adds or removes the UIView instance according to the set animation mode. When the animation mode is not set, the default animation mode is adopted to realize the customization of the animation mode, thereby ensuring the diversity and flexibility of the animation mode during the addition and removal of the UIView instance.

[0088] According to a navigation device of a UIView instance provided by the present invention, the push operation processing module 20 is specifically used to add the upper UIView instance to the currently displayed UIView instance: if the animation mode is from left to right, the upper UIView instance is placed to the left of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a left to right animation; if the animation mode is from right to left, the upper UIView instance is placed to the right of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a right to left animation. The upper UIView instance overlaps with the currently displayed UIView instance; if the animation method is from top to bottom, the upper UIView instance is placed directly above the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a top-down animation; if the animation method is from bottom to top, the upper UIView instance is placed directly below the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a bottom-up animation; after the animation ends, the upper UIView instance is added to the currently displayed UIView instance using the addsubview method.

[0089] The navigation device for UIView instances provided by the present invention improves the reliability of adding the upper-layer UIView instance to the currently displayed UIView instance by using various animation methods by respectively providing specific methods of adding the upper-layer UIView instance to the currently displayed UIView instance in animation methods from left to right, from right to left, from top to bottom, and from bottom to top.

[0090] According to a navigation device of a UIView instance provided by the present invention, the pop operation processing module 30, when used to remove other UIView instances covering the lower UIView instance according to the animation method carried by the pop operation, is specifically used to: if the animation method is from left to right, then use the right to left animation to remove other UIView instances covering the lower UIView instance; if the animation method is from right to left, then use the left to right animation to remove other UIView instances covering the lower UIView instance; if the animation method is from top to bottom, then use the bottom to top animation to remove other UIView instances covering the lower UIView instance; if the animation method is from bottom to top, then use the top to bottom animation to remove other UIView instances covering the lower UIView instance; after the animation ends, the other UIView instances covering the lower UIView instance are removed by the removeFromSuperView method.

[0091] The navigation device for UIView instances provided by the present invention improves the reliability of removing other UIView instances covering the lower UIView instance by using various animation methods by providing specific methods for removing other UIView instances covering the lower UIView instance from left to right, from right to left, from top to bottom, and from bottom to top.

[0092] Figure 5 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 5As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the navigation method of the UIView instance, which includes: receiving a trigger operation for the currently displayed UIView instance, and determining whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to the upper-level UIView instance, and the pop operation indicates a return to the lower-level UIView instance; if it is known that the trigger operation is the push operation, then according to the push operation, the upper-level UIView instance to be jumped is obtained, and the upper-level UIView instance is added to the currently displayed UIView instance; if it is known that the trigger operation is the pop operation, then according to the pop operation, the lower-level UIView instance to be returned is obtained, and other UIView instances covering the lower-level UIView instance are removed, thereby displaying the lower-level UIView instance.

[0093] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium and includes several instructions for enabling 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 method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0094] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the navigation method of the UIView instance provided by the above methods, the method including: receiving a trigger operation for the currently displayed UIView instance, and determining whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to the upper-level UIView instance, and the pop operation indicates a return to the lower-level UIView instance; if it is known that the trigger operation is the push operation, then according to the push operation, the upper-level UIView instance to be jumped is obtained, and the upper-level UIView instance is added to the currently displayed UIView instance; if it is known that the trigger operation is the pop operation, then according to the pop operation, the lower-level UIView instance to be returned is obtained, and other UIView instances covering the lower-level UIView instance are removed, thereby displaying the lower-level UIView instance.

[0095] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the navigation method for the UIView instances provided above, the method comprising: receiving a trigger operation for the currently displayed UIView instance, and determining whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to an upper-level UIView instance, and the pop operation indicates a return to a lower-level UIView instance; if it is known that the trigger operation is the push operation, then according to the push operation, the upper-level UIView instance to be jumped is obtained, and the upper-level UIView instance is added to the currently displayed UIView instance; if it is known that the trigger operation is the pop operation, then according to the pop operation, the lower-level UIView instance to be returned is obtained, and other UIView instances covering the lower-level UIView instance are removed, thereby displaying the lower-level UIView instance.

[0096] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0097] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling 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 certain parts of the embodiments.

[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A navigation method for a UIView instance, characterized in that: include: Receive a trigger operation for the currently displayed UIView instance, and determine whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates jumping to the upper UIView instance, and the pop operation indicates returning to the lower UIView instance; If it is learned that the trigger operation is the push operation, the upper-layer UIView instance to be jumped to is obtained according to the push operation, and the upper-layer UIView instance is added to the currently displayed UIView instance; the adding of the upper-layer UIView instance to the currently displayed UIView instance specifically includes: obtaining the frame attribute of the underlying UIView instance, the frame attribute including the position and size of the UIView instance; and adding the upper-layer UIView instance to the currently displayed UIView instance according to the frame attribute; If it is known that the trigger operation is the pop operation, the lower-level UIView instance that needs to be returned is obtained according to the pop operation, and other UIView instances covering the lower-level UIView instance are removed to display the lower-level UIView instance; the UIView instance is assigned an instance serial number, and the instance serial number increases sequentially starting from the bottom-level UIView instance according to the view hierarchy; obtaining the lower-level UIView instance that needs to be returned according to the pop operation specifically includes: determining whether the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned; if the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned, obtaining the corresponding UIView instance according to the instance serial number as the lower-level UIView instance that needs to be returned.

2. The navigation method of a UIView instance according to claim 1, characterized in that: After adding the upper UIView instance to the currently displayed UIView instance, the method further includes: appending the upper UIView instance to a routing stack; After removing the other UIView instances covering the lower UIView instance, the method further includes: removing the other UIView instances covering the lower UIView instance from the routing stack.

3. The navigation method of the UIView instance according to claim 2, characterized in that: The step of obtaining the lower UIView instance to be returned according to the pop operation further includes: If the pop operation does not carry the instance serial number of the lower-layer UIView instance that needs to be returned, the routing stack is queried and the previous UIView instance of the currently displayed UIView instance that was pushed onto the stack earlier is used as the lower-layer UIView instance that needs to be returned.

4. The navigation method of a UIView instance according to claim 1, characterized in that: The adding the upper-layer UIView instance to the currently displayed UIView instance specifically includes: if the push operation carries an animation mode, adding the upper-layer UIView instance to the currently displayed UIView instance according to the animation mode carried by the push operation; if the push operation does not carry an animation mode, adding the upper-layer UIView instance to the currently displayed UIView instance in a default animation mode; The removing of other UIView instances covering the lower UIView instance specifically includes: if the pop operation carries an animation mode, removing other UIView instances covering the lower UIView instance according to the animation mode carried by the pop operation; if the pop operation does not carry an animation mode, removing other UIView instances covering the lower UIView instance in a default animation mode; The animation mode includes at least one of left to right, right to left, top to bottom, and bottom to top.

5. The navigation method of the UIView instance according to claim 4, characterized in that: Adding the upper UIView instance to the currently displayed UIView instance according to the animation method carried by the push operation specifically includes: If the animation mode is from left to right, the upper UIView instance is placed to the left of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a left to right animation; If the animation mode is from right to left, the upper UIView instance is placed to the right of the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a right to left animation; If the animation mode is from top to bottom, the upper UIView instance is placed directly above the currently displayed UIView instance, and a top-down animation is used to move the upper UIView instance to overlap with the currently displayed UIView instance; If the animation mode is from bottom to top, the upper UIView instance is placed directly below the currently displayed UIView instance, and the upper UIView instance is moved to overlap with the currently displayed UIView instance using a bottom-up animation; After the animation ends, the addsubview method is used to add the upper UIView instance to the currently displayed UIView instance.

6. The navigation method of a UIView instance according to claim 4, characterized in that: Removing other UIView instances covering the lower UIView instance according to the animation method carried by the pop operation specifically includes: If the animation mode is from left to right, then use the right to left animation to remove other UIView instances covering the lower UIView instance; if the animation mode is from right to left, then use the left to right animation to remove other UIView instances covering the lower UIView instance; if the animation mode is from top to bottom, then use the bottom to top animation to remove other UIView instances covering the lower UIView instance; if the animation mode is from bottom to top, then use the top to bottom animation to remove other UIView instances covering the lower UIView instance; After the animation ends, the other UIView instances covering the lower UIView instance are removed through the removeFromSuperView method.

7. A navigation device for a UIView instance, characterized in that: include: A trigger operation receiving and judging module is used to: receive a trigger operation for the currently displayed UIView instance and judge whether the trigger operation is a push operation or a pop operation; wherein the push operation indicates a jump to the upper UIView instance, and the pop operation indicates a return to the lower UIView instance; A push operation processing module is configured to: if it is learned that the trigger operation is the push operation, obtain the upper-layer UIView instance to be redirected according to the push operation, and add the upper-layer UIView instance to the currently displayed UIView instance; the adding of the upper-layer UIView instance to the currently displayed UIView instance specifically includes: obtaining the frame attribute of the underlying UIView instance, the frame attribute including the position and size of the UIView instance; and adding the upper-layer UIView instance to the currently displayed UIView instance according to the frame attribute; A pop operation processing module is used for: if it is known that the trigger operation is the pop operation, obtaining the lower-level UIView instance that needs to be returned according to the pop operation, removing other UIView instances covering the lower-level UIView instance, thereby displaying the lower-level UIView instance; the UIView instance is assigned an instance serial number, and the instance serial number increases sequentially starting from the bottom-level UIView instance according to the view hierarchy; obtaining the lower-level UIView instance that needs to be returned according to the pop operation specifically includes: determining whether the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned; if the pop operation carries the instance serial number of the lower-level UIView instance that needs to be returned, obtaining the corresponding UIView instance according to the instance serial number as the lower-level UIView instance that needs to be returned.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the navigation method of the UIView instance as claimed in any one of claims 1 to 6 are implemented.

9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the navigation method of the UIView instance according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Page navigation processing method and device for application programs

    CN107832051A

  • Navigation backspacing method and control

    CN110147184A