View transition method and device, electronic device, and storage medium
By using the target controller as a transition proxy in the iOS system and leveraging its initialization method and animation control class to implement view transition animations, the problems of single system transition animations and multiple parameter passing are solved, enabling convenient control of custom view transition effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE M2M
- Filing Date
- 2021-07-16
- Publication Date
- 2026-04-21
AI Technical Summary
Existing iOS system transition animation methods are limited and cannot meet the independent control of complex view animation effects. They also require a large number of parameters to be passed, which increases the workload of programmers.
By using the target controller as a transition proxy, the transition animation type is determined through the target controller's initialization method, and the animation proxy method is implemented through the transition animation control class to control the view animation and effect parameters, thus decoupling the transition animation from the current controller.
It enables convenient control over custom view transition effects, reduces parameter passing, simplifies the implementation of complex transition animations, and is suitable for various electronic devices.
Smart Images

Figure CN115619908B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and includes, but is not limited to, view transition methods and apparatus, electronic devices, and storage media. Background Technology
[0002] With the development of the internet, mobile phones, computers, tablets and other devices are becoming increasingly common. When certain operations are triggered on these devices, users expect visual feedback, and the system needs to clearly indicate that it has received the operation and that the corresponding request is in progress.
[0003] Apple's iOS mobile operating system is widely used globally, and the requirements for iOS software are becoming increasingly demanding, particularly regarding appearance and animation. The built-in transition animations in Objective-C, provided by Apple, cannot meet the requirements of all applications (apps). While existing development resources offer descriptions of transition animations, adding them one by one would impose a heavy workload on programmers. Related technologies require implementing animation methods independently, and more complex transition animations require passing a large number of parameters. Summary of the Invention
[0004] This application provides a view transition method, apparatus, electronic device, and storage medium, which at least solves the problem that the system default transition method is singular and cannot meet the independent control of the animation effects of the presented page view.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, this application provides a view transition method, the method comprising:
[0007] When the transition animation type during the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy during the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller;
[0008] The transition animation proxy method defined in the transition animation control class is implemented through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition.
[0009] Secondly, this application provides a view transition device, including a first determining module and a first control module, wherein:
[0010] The first determining module is used to, when the type of the transition animation in the transition process is a custom animation, use the target controller corresponding to the page to be displayed as the transition proxy in the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller;
[0011] The first control module is used to implement the transition animation proxy method defined in the transition animation control class through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition.
[0012] Thirdly, this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement the steps in the above-described view transition method.
[0013] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described view transition method.
[0014] The beneficial effects of the technical solution provided in this application include at least the following:
[0015] In this embodiment, firstly, when the transition animation type during the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy during the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller; then, the transition animation proxy method defined in the transition animation control class is implemented through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition process; thus, by providing a transition animation control class, and having a built-in transition animation proxy method in this class, and having the target controller conveniently implement the view transition effect, it is not necessary to pass a large number of parameters to the system, thus solving the limitation of the system's default transition. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein:
[0017] Figure 1A This refers to the view transition solutions based on Objective-C provided in related technologies;
[0018] Figure 1BA schematic flowchart illustrating a view transition method provided in an embodiment of this application;
[0019] Figure 2 A schematic flowchart illustrating a view transition method provided in an embodiment of this application;
[0020] Figure 3 A schematic flowchart illustrating a view transition method provided in an embodiment of this application;
[0021] Figure 4 A system block diagram of the view transition method provided in the embodiments of this application;
[0022] Figure 5 A logic flowchart of the view transition method provided in the embodiments of this application;
[0023] Figure 6 A schematic diagram of the composition structure of a view transition device provided in an embodiment of this application;
[0024] Figure 7 This is a schematic diagram of the hardware entity of an electronic device provided in an embodiment of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0027] It should be noted that the terms "first, second, and third" used in the embodiments of this application are merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0028] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which the embodiments of this application pertain. It should also be understood that terms such as those defined in general dictionaries should be understood to have a meaning consistent with their meaning in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0029] In the existing Model-View-Controller (MVC) architecture, the User Interface (UI) Navigation Controller, besides controlling the View Controller hierarchy within the UI stack, allows developers to customize transition animations through its delegate functionality. The first step in customizing transitions is to provide a Transition Delegate, which tells the system to use the provided delegate instead of the system's default delegate to execute the transition process.
[0030] During the transition, the parent view controller, which acts as a container, maintains multiple child view controllers, but in terms of view structure, only the view of one child view controller is retained. Therefore, the essence of the transition is that the view of the next scene (equivalent to the first child view) replaces the view of the current scene (equivalent to the second child view) and the corresponding controller switching, which is manifested as the current view disappearing and the next view appearing. Animation is based on this, and there are many ways to do animation.
[0031] A related technology discloses a view transition scheme based on Objective-C, such as... Figure 1A As shown, this method uses the native Objective-C encapsulation interface and leverages the native underlying framework for custom encapsulation and combination. It adds custom view transition animation methods 12 based on the underlying transition protocol of the framework (UIKit) 11, including custom view transition methods and transition times. The underlying transition protocol includes UIViewControllerContextTransitioning 13, UIViewControllerAnimatedTransitioning 14, and UIViewControllerInteractiveTransitioning 15.
[0032] This method for view transitions based on the Objective-C language is suitable for applications with high requirements for view transition animation styles. Based on Objective-C technology, it uses the native encapsulation interface of Objective-C, reuses the native underlying framework to create custom encapsulation components, and adds custom view transition methods and transition times.
[0033] This application provides a view transition method applied to an electronic device. The electronic device includes, but is not limited to, mobile phones, laptops, tablets and handheld internet devices, multimedia devices, streaming media devices, mobile internet devices, wearable devices, or other types of electronic devices. The function implemented by this method can be achieved by a processor in the electronic device calling program code. The program code can be stored in a computer storage medium; therefore, the electronic device includes at least a processor and a storage medium. The processor can be used to process the view transition process, and the memory can be used to store the data required and generated during the view transition process.
[0034] Figure 1B This is a flowchart illustrating a view transition method provided in an embodiment of this application, as shown below. Figure 1B As shown, the method includes at least the following steps:
[0035] Step S110: If the type of transition animation in the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy in the transition process.
[0036] Here, the transition animation refers to the effect animation displayed during the switching between two pages as a whole or subviews, such as horizontal push-in, fade-out, fade-in, flip, page turning, etc.
[0037] In some implementations, the transition animation type can be the system default animation type; in other implementations, the transition animation type can be a custom animation. The type of the transition animation is determined by the initialization method of the target controller.
[0038] Transitions are needed in any application where you need to switch from one page to another. Generally, system transition controls are used, but in some applications with high requirements for view transition animation styles, custom transition effects are also necessary. For example, when a user logs into an application, they need to switch from the login page to the homepage; this switching process is a transition.
[0039] It should be noted that in the object proxy data model, a proxy is an object that can inherit some or all of the properties and methods of the source object, and can also add properties and methods that are not present in the source object to meet the needs of different applications. In some embodiments, the target controller is the view controller of the page to be displayed, and the entire transition animation controls the animation of the target controller's view and subviews. Therefore, using the target controller as a transition proxy in the transition process facilitates fine-grained control of the target controller's subviews.
[0040] Step S120: Implement the transition animation proxy method defined in the transition animation control class through the target controller;
[0041] Here, the transition animation control class defines transition animations and provides transition animation delegate methods to the outside world. The transition animation delegate methods are used to control the view animation and effect parameters of the page to be displayed during the transition process.
[0042] View animations include horizontal push-in, fade-out, fade-in, flip, page turning, etc.; effect parameters include the animation elements required for transition animations, the initial position of the animation elements, the ending position of the animation elements, the initial angle (alpha) of the animation elements, the ending angle of the animation elements, the animation scaling ratio, the animation start time, the animation duration, whether the animation elements are hidden before the animation, whether the animation elements are hidden after the animation, etc.
[0043] In this application embodiment, a transition animation controller class is provided in the entire transition mechanism. This class encapsulates display animation methods and disappearance animation methods. When the target controller implements these transition animation proxy methods, new view size, angle, opacity and other parameters are set, so that the control of the entire transition animation is completely in the target controller.
[0044] In some embodiments, the transition animation control class implements at least one of the following functions: animation management, display state management, container management, and controller main view management; wherein, the animation management function mainly manages and previews the animation trajectory and modifies keyframes and their attributes; the display state management function is mainly responsible for a display state presented to the user on the interface, such as loading display, error information display, list display, etc.; Docker is an open-source application container engine, which is a state after an image is run. Each container runs an application and provides a complete runtime environment for that application; the controller main view management is used to manage the view of the page.
[0045] When a transition begins, the transition animation delegate method implemented in the transition animation controller class is triggered. Different animation methods within this delegate method are called depending on the transition scenario. In some implementations, the display animation method is triggered when switching from the current page to the page to be displayed—that is, during the gradual display of the page to be displayed and the transition to the target controller. In other implementations, the disappearance animation method is triggered when returning from the page to be displayed to the current page—that is, during the gradual disappearance of the page to be displayed and the transition to the current controller.
[0046] In related technologies, the system acts as a transition proxy, requiring the target controller to directly pass the view animation and effect parameters of the page to be displayed during the transition process to the system's transition controller class. The transition controller class then controls and implements the transition animation. This transition controller class is tightly coupled with the business logic and animation effects, and different transition animations require different methods to be added to this transition controller class.
[0047] The transition animation control class proposed in this application does not involve any business logic or transition effects; it merely provides a transition animation proxy method. The actual transition effect is implemented by the proxy of the transition animation control class, i.e., the target controller. Therefore, this application decouples the transition animation from the current controller, allowing for easy implementation of different transition effects when navigating from the same controller view to different target controllers.
[0048] In this embodiment, firstly, when the transition animation type during the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy during the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller; then, the transition animation proxy method defined in the transition animation control class is implemented through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition process; thus, by providing a transition animation control class, and having a built-in transition animation proxy method in this class, and having the target controller conveniently implement the view transition effect, it is not necessary to pass a large number of parameters to the system, thus solving the limitation of the system's default transition.
[0049] In some embodiments, the lifecycle of the transition animation includes at least two time points in chronological order, wherein the lifecycle of the transition animation is the time period from when the next page is about to be displayed to when the previous page completely disappears. The transition animation delegate methods defined in the transition animation control class include a lifecycle delegate method corresponding to each time point in the lifecycle of the transition animation.
[0050] Figure 2 This is a flowchart illustrating a view transition method provided in an embodiment of this application, as shown below. Figure 2 As shown, the method further includes the following steps:
[0051] Step S210: In response to receiving a transition command to switch from the current page to the page to be displayed, the initialization method of the target controller is triggered;
[0052] Here, the current page and the page to be displayed refer to the user interface (UI), such as the interface displayed by an application or the interface of a webpage. The current page is the page before the transition, and the page to be displayed is the page after the transition. The process from the disappearance of the current page to the full display of the page to be displayed is the transition process. When a page switch needs to be achieved through a transition, the user can generate a transition command through mouse clicks, touch, or voice.
[0053] Step S220: Based on the initialization method of the target controller, determine the type of transition animation in the transition process;
[0054] In implementation, the transition animation type can be defined as a custom animation in the initialization method of the target controller. When a transition occurs, the initialization method of the target controller will be triggered, and the system default transition process or the custom transition process will be executed based on the type of transition animation.
[0055] Step S230: If the type of transition animation in the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy in the transition process.
[0056] Here, when navigating from the current page to the page to be displayed and requiring a custom animation, the target controller is used as a transition proxy. When the page to be displayed is shown or disappeared through a transition, the target controller is called by the system to implement the system's controller switching proxy method.
[0057] Step S240: In chronological order, the lifecycle proxy method corresponding to each time node is implemented sequentially by the target controller.
[0058] Here, the lifecycle proxy method includes the original controller parent view parameters and the target controller parent view parameters, and the lifecycle proxy method is used to control the animation of the subviews of the target controller.
[0059] In implementation, at each time point in the transition animation's lifecycle, the transition animation controller internally calls the corresponding lifecycle delegate method for each time point. Simultaneously, the external target controller acts as the transition animation delegate, implementing the properties of the various views changed by these lifecycle delegate methods, such as setting new view sizes, angles, and opacities. In other words, the animation effects at different time points defined in the lifecycle delegate methods are implemented by the transition animation delegate, i.e., the target controller.
[0060] In some implementations, for scenarios where the current page jumps to the page to be displayed, the lifecycle of the transition animation is divided into three time nodes: the first time node when the transition animation is about to be executed, the second time node when the transition animation is in progress, and the third time node when the transition animation is completed. The initial state of the transition animation is that the current page view is displayed and the view of the page to be displayed is hidden.
[0061] In other implementations, for scenarios where the page to be displayed returns to the current page, the lifecycle of the transition animation is still divided into the three time nodes mentioned above. However, the initial state of the transition animation is that the view of the page to be displayed is displayed while the view of the current page is hidden.
[0062] The timing of transition animation calls is determined by the transition animation controller class, which is also a property of the target controller. When the target controller implements these lifecycle delegate methods, changes to view properties within those methods are animated, thus completing a transition animation.
[0063] In this embodiment, when a transition occurs, such as switching from the current page to the page to be displayed, the initialization method of the target controller is triggered. If the transition animation type defined in the initialization method is a custom animation, the target controller is used as a transition proxy. Then, in chronological order, the lifecycle proxy method corresponding to each time node is implemented sequentially through the target controller. In this way, by providing the target controller with proxy methods based on different time nodes of the transition animation lifecycle through the transition animation control class, fine-grained control of the target controller's subviews can be achieved according to the transition lifecycle nodes.
[0064] Figure 3 This is a flowchart illustrating a view transition method provided in an embodiment of this application, as shown below. Figure 3 As shown, the method further includes the following steps:
[0065] Step S310: If the transition animation type is a custom animation, the target controller is invoked;
[0066] Here, when the transition animation type is a custom animation, a custom transition process is executed, that is, the target controller is called by the system when the display page is shown or disappeared through a transition.
[0067] When a transition needs to occur, the initialization method of the target controller is triggered. The initialization method of the target controller determines whether the type of the transition animation is a custom animation. If it is a custom animation, the target controller is used as the system's transition proxy, that is, the controller switching proxy and the proxy of the transition animation controller class.
[0068] Step S320: Implement the system proxy method through the target controller;
[0069] Here, the system proxy method is used to control the display of the page to be shown through transitions.
[0070] It is worth noting that the transition animation control class is a property of the target controller, which makes the target controller also act as a proxy of the transition animation control class. During the execution of the system proxy method by the target controller, the transition animation proxy method in the transition animation control class is called.
[0071] Step S330: Determine the transition attributes in the transition animation control class;
[0072] Here, the transition attribute is used to characterize the transition process as either the type of view display of the target controller or the type of view disappearance of the target controller; the type of view display of the target controller indicates the transition type that occurs when switching from the current page to the page to be displayed; the type of view disappearance of the target controller indicates the transition type that occurs when returning from the page to be displayed to the current page.
[0073] Step S340: Based on the transition attributes, control the target controller to implement the transition animation proxy method.
[0074] Here, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition process.
[0075] It is worth noting that the transition animation control class will adjust the value of the transition property in the class according to the external method call, and control the call of different animation methods according to the value of the transition property based on the transition animation delegate method implemented in the transition animation control class.
[0076] The transition animation proxy method includes a display animation method and a disappearance animation method. In some embodiments, when the transition attribute indicates that the transition process is the display of the view of the target controller, the target controller is controlled to implement the display animation method; in other embodiments, when the transition attribute indicates that the transition process is the disappearance of the view of the target controller, the target controller is controlled to implement the disappearance animation method.
[0077] In this embodiment, firstly, when the transition animation type is a custom animation, the target controller is invoked; then, the system proxy method is implemented through the target controller; next, the transition attributes in the transition animation control class are determined; finally, based on the transition attributes, the target controller is controlled to implement the transition animation proxy method. Thus, when switching to the target controller or exiting the target controller and returning to the current controller, the target controller acts as a transition proxy to implement the system proxy method. At the same time, the transition animation controller class adjusts the transition attributes defined in the class according to the different implementation processes of the target controller, thereby controlling the target controller to control different animation method calls according to the value of the transition attribute, thus conveniently achieving complex transition effects.
[0078] The above view transition method will be described below with reference to a specific embodiment. However, it should be noted that this specific embodiment is only for better illustration of this application and does not constitute an improper limitation of this application.
[0079] This application primarily addresses the limitations of default system transitions. The main logic of default transitions is page switching and control, while custom transitions enable complex interactive displays across multiple pages and independent control over the animations and display effects of subviews within the presented interface. The control system in this application includes animation management, display state management, container management, and controller main view management. It provides lifecycle proxy methods, passing the original controller parent view and the child controller parent view within these methods. This facilitates fine-grained control of the target controller's subviews, thereby easily achieving complex transition effects.
[0080] Figure 4 A system block diagram of the view transition method provided in the embodiments of this application is shown below. Figure 4As shown, when it is necessary to jump from the original page 41 (equivalent to the current page) to the page to be displayed 46, the transition delegate is handed over to the controller of the page to be displayed, i.e. the target controller. The target controller needs to implement the system's delegate method. The target controller holds the transition animation control class, which implements animation management 42, display state management 43, container management 44, and controller main view management 45. The target controller, acting as a proxy for this transition animation control class, implements the six proxy methods provided by the transition animation control class: "willPresent(fromView:UIView,toView:UIView)" (transition animation about to appear), "onPresent(fromView:UIView,toView:UIView)" (transition animation in progress), "didPresent(fromView:UIView,toView:UIView)" (transition animation completed), "willDismiss(fromView:UIView,toView:UIView)" (transition animation about to disappear), "onDismiss(fromView:UIView,toView:UIView)" (transition animation disappearing), and "didDismiss(fromView:UIView,toView:UIView)" (transition animation completed). Within these six proxy methods, it controls the parameter changes of each view during the transition, comparing transparency, angle, size, shape, etc.
[0081] Figure 5 The logic flowchart of the view transition method provided in the embodiments of this application is as follows: Figure 5 As shown, the method includes at least the following steps:
[0082] Step S510: When a transition needs to occur, the initialization method of the target controller will be triggered;
[0083] The transition process involves two controllers: the current controller, which controls the full view displayed on the screen; and the target controller, which controls the full view to be displayed. The entire transition animation controls the animation of the target controller's view and its subviews.
[0084] Step S520: Determine whether the transition animation is a custom animation through the initialization method of the target controller;
[0085] Step S530: If it is a custom animation, use the target controller as the system's controller switching proxy and the proxy for the transition animation controller class.
[0086] The target controller acts as the system's controller switching agent (equivalent to a transition agent), implementing the system's controller switching agent method (equivalent to a system agent method). The controller switching agent method is automatically triggered when switching to the target controller or exiting the target controller and returning to the current controller.
[0087] In the controller switching delegate method, the display animation method and disappearance animation method of the transition animation controller class are called. The transition animation controller class will adjust the property value in the class (equivalent to the value of the transition property) according to the external method call, and control the call of different animation methods according to the property value in the transition animation delegate method implemented in the class.
[0088] When a transition begins, the system transition delegate methods implemented in the transition animation control class are triggered. These methods define display animation methods and disappearance animation methods. Different lifecycle delegate methods are called at different time points within the animation methods (e.g., ...). Figure 4 As shown, the transition animation will be displayed in method 421, and the transition animation will be displayed in method 422, etc. These lifecycle delegate methods implemented by the target controller will also be called synchronously, and changes to view properties in the delegate methods will be animated. Thus, a complete show and disappearance transition animation is finished.
[0089] Within the entire transition mechanism, a separate transition animation control class is provided. This class exposes delegate methods for six time points from the moment the next page is about to appear until the previous page completely disappears. Internally, it encapsulates display and disappearance animation methods, and calls these delegate methods within different animation method nodes (corresponding to the six time points mentioned above). Target parameters changed by these delegate methods (such as setting new view size, angle, opacity, etc. within the delegate methods) will also be invoked at the appropriate times. Simultaneously, it internally controls and manages the view of the target controller and the current controller, as well as effect control parameters such as animation duration.
[0090] Because the target controller provides control methods for different time points in the transition animation lifecycle, users can define the parameters of subviews and the final display effect of the animation within the target controller, eliminating the need to encapsulate these subviews and control them separately. Furthermore, this application provides a general animation control method, offering control methods for different points in the transition animation lifecycle to the target controller. Animation customization is completed within the target controller, eliminating the need to create additional files for each transition.
[0091] Based on this transition animation control class, the control of the entire transition animation rests entirely with the target controller. This decouples the transition animation from the current controller, allowing for easy transitions between different target controllers from the same controller view. Therefore, the view transition method provided in this embodiment can be adapted to custom transitions in all scenarios.
[0092] In this application embodiment, a method for fine-grained control of target controller subviews based on transition lifecycle nodes is provided using the Swift programming language. This application also provides a custom proxy method implemented through the target controller, meaning that subview state control is implemented within the target controller without requiring parameter passing. Each target controller can achieve different transition effects, and the entire project requires only one proxy class.
[0093] This application provides an internal animation method control, requiring only the implementation of subview state control in the target controller, without the need for parameter passing. This effectively avoids the shortcomings of related technologies that require the independent implementation of animation methods, and, for more complex transition animations, the need for a large number of parameter passing.
[0094] This application provides six control nodes in chronological order, with a clear process and sub-views that allow for fine-grained control. It is more applicable to complex transitions and solves the problems of centralized control methods, unclear transition control processes, and poor reusability.
[0095] Based on the foregoing embodiments, this application further provides a view transition device, which includes the included modules and the units included in each module, which can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0096] Figure 6 This is a schematic diagram of the composition structure of a view transition device provided in an embodiment of this application, as shown below. Figure 6 As shown, the device 600 includes: a first determining module 610 and a first control module 620, wherein:
[0097] The first determining module 610 is used to, when the type of the transition animation in the transition process is a custom animation, use the target controller corresponding to the page to be displayed as the transition proxy in the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller;
[0098] The first control module 620 is used to implement the transition animation proxy method defined in the transition animation control class through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition process.
[0099] In some possible embodiments, the device 600 further includes a triggering module and a second determining module, wherein: the triggering module is configured to trigger the initialization method of the target controller in response to receiving a transition instruction to switch from the current page to the page to be displayed; the second determining module is configured to determine the type of transition animation in the transition process based on the initialization method of the target controller.
[0100] In some possible embodiments, the transition animation control class implements at least one of the following functions: animation management, display state management, container management, and controller main view management.
[0101] In some possible embodiments, the first determining module 610 includes a calling submodule and an execution submodule, wherein: the calling submodule is used to call the target controller when the transition animation type is a custom animation; the execution submodule is used to implement the system proxy method through the target controller; wherein the system proxy method is used to control the page to be displayed to be displayed or disappear through a transition.
[0102] In some possible embodiments, the implementation submodule includes a determining unit and an implementing unit, wherein: the determining unit is used to determine the transition attributes in the transition animation control class; wherein the transition attributes are used to characterize the transition process as the display of the view of the target controller or the disappearance of the view of the target controller; the implementing unit is used to control the target controller to implement the transition animation proxy method based on the transition attributes.
[0103] In some possible embodiments, the transition animation proxy method includes a display animation method and a disappearance animation method; the implementation unit includes a first implementation subunit and a second implementation subunit, wherein: the first implementation subunit is used to control the target controller to implement the display animation method when the transition attribute indicates that the transition process is the display of the view of the target controller; the second implementation subunit is used to control the target controller to implement the disappearance animation method when the transition attribute indicates that the transition process is the disappearance of the view of the target controller.
[0104] In some possible embodiments, the transition animation proxy method includes a lifecycle proxy method corresponding to each time node in the lifecycle of the transition animation; the device 600 further includes a second control module, used to implement the lifecycle proxy method corresponding to each time node sequentially through the target controller in chronological order; wherein, the lifecycle proxy method includes the original controller parent view parameters and the target controller parent view parameters, and the lifecycle proxy method is used to control the subview animation of the target controller.
[0105] It should be noted that the descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0106] It should be noted that, in the embodiments of this application, if the above-described view transition method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a smartphone, tablet computer, etc. with a camera) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0107] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in any of the view transition methods described in the above embodiments. Correspondingly, embodiments of this application also provide a chip, the chip including programmable logic circuitry and / or program instructions, which, when executed, implements the steps in any of the view transition methods described in the above embodiments. Correspondingly, embodiments of this application also provide a computer program product, which, when executed by a processor of an electronic device, implements the steps in any of the view transition methods described in the above embodiments.
[0108] Based on the same technical concept, this application provides an electronic device for implementing the view transition method described in the above method embodiments. Figure 7 This is a hardware entity diagram of an electronic device provided in an embodiment of this application, such as... Figure 7 As shown, the electronic device 700 includes a memory 710 and a processor 720. The memory 710 stores a computer program that can run on the processor 720. When the processor 720 executes the program, it implements the steps in any of the view transition methods described in the embodiments of this application.
[0109] The memory 710 is configured to store instructions and applications executable by the processor 720, and can also cache data to be processed or already processed by the processor 720 and various modules in the electronic device (e.g., image data, audio data, voice communication data and video communication data), which can be implemented by flash memory or random access memory (RAM).
[0110] The processor 720 executes the steps of any of the above-mentioned view transition methods when executing the program. The processor 720 typically controls the overall operation of the electronic device 700.
[0111] The aforementioned processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), Controller, Microcontroller, and Microprocessor. It is understood that other electronic devices can also implement the functions of the aforementioned processor, and this application does not specifically limit the specific implementation.
[0112] The aforementioned computer storage media / memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; or it can be various electronic devices that include one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0113] It should be noted that the descriptions of the storage medium and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0114] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0115] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0117] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0118] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0119] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause the device automatic test line to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0120] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0121] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0122] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A view transition method, characterized in that, The method includes: When the transition animation type during the transition process is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy during the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller; The transition animation proxy method defined in the transition animation control class is implemented through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition; the transition animation proxy method includes a lifecycle proxy method corresponding to each time node in the lifecycle of the transition animation; the lifecycle of the transition animation includes at least two time nodes in chronological order, wherein the lifecycle of the transition animation represents the time period from when the next page is about to be displayed to when the previous page completely disappears; The implementation of the transition animation proxy method defined in the transition animation control class through the target controller includes: In chronological order, the lifecycle proxy method corresponding to each time node is implemented sequentially through the target controller; wherein, the lifecycle proxy method includes the original controller parent view parameters and the target controller parent view parameters, and the lifecycle proxy method is used to control the subview animation of the target controller.
2. The method as described in claim 1, characterized in that, The method further includes: In response to receiving a transition command to switch from the current page to the page to be displayed, the initialization method of the target controller is triggered; Based on the initialization method of the target controller, the type of transition animation in the transition process is determined.
3. The method as described in claim 1, characterized in that, The transition animation control class shall implement at least one of the following functions: animation management, display status management, container management, and controller main view management.
4. The method according to any one of claims 1 to 3, characterized in that, When the transition animation type is a custom animation, the target controller corresponding to the page to be displayed is used as the transition proxy in the transition process, including: If the transition animation is a custom animation, then the target controller is invoked; The system proxy method is implemented through the target controller; wherein the system proxy method is used to control the page to be displayed to be shown or disappeared through transitions.
5. The method as described in claim 4, characterized in that, The implementation of the transition animation proxy method defined in the transition animation control class through the target controller includes: Determine the transition attributes in the transition animation control class; wherein, the transition attributes are used to characterize the transition process as the display of the view of the target controller or the disappearance of the view of the target controller; Based on the transition attributes, the target controller is controlled to implement the transition animation proxy method.
6. The method as described in claim 5, characterized in that, The transition animation proxy method includes a display animation method and a disappearance animation method; the step of controlling the target controller to implement the transition animation proxy method based on the transition attributes includes: When the transition attribute characterizes the transition process as a view display of the target controller, the target controller is controlled to implement the display animation method; When the transition attribute indicates that the transition process is the disappearance of the view of the target controller, the target controller is controlled to implement the disappearance animation method.
7. A view transition device, characterized in that, The device includes a first determining module and a first control module, wherein: The first determining module is used to, when the type of the transition animation in the transition process is a custom animation, use the target controller corresponding to the page to be displayed as the transition proxy in the transition process; wherein, the type of the transition animation is determined by the initialization method of the target controller; The first control module is used to implement the transition animation proxy method defined in the transition animation control class through the target controller; wherein, the transition animation proxy method is used to control the view animation and effect parameters of the page to be displayed during the transition process; The transition animation proxy method includes a lifecycle proxy method corresponding to each time node in the lifecycle of the transition animation; the lifecycle of the transition animation includes at least two time nodes in chronological order, wherein the lifecycle of the transition animation represents the time period from when the next page is about to be displayed to when the previous page completely disappears; The device further includes a second control module, used to sequentially implement the lifecycle proxy method corresponding to each time node through the target controller in chronological order; wherein, the lifecycle proxy method includes the original controller parent view parameters and the target controller parent view parameters, and the lifecycle proxy method is used to control the subview animation of the target controller.
8. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Transition animation realization method and device
CN107463367A