iOS concurrent animation callback program construction method, callback method and device
By using the extended proxy chain method in iOS development, creating views and animation objects, and setting a separate proxy object for each animation object, the animation callback problem during concurrent playback of multiple animations in iOS development is solved, and the simple, efficient and reliable management of high concurrent animations is achieved.
Patent Information
- Application Number
- CN202210856957.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-07-20
AI Technical Summary
In iOS development, when multiple animations are played concurrently on the same page, animation callbacks are difficult to distinguish, and the existing technical solutions are complex and difficult to ensure thread safety, resulting in a confusing order of animation execution and it is difficult to achieve reliable callbacks for high concurrent animations.
By extending the proxy chain, n views and animation objects in the view controller are created, and separate proxy objects are set for each animation object. The CAAnimationDelegate protocol is used to realize callback notification after the animation is over, and one-to-one management of proxy and animation is realized, simplifying the controllability and reliability of animations.
It realizes simple, efficient and reliable management of high concurrent animation callbacks in iOS development, improves the controllability of animations, and solves the problems of animation execution order and thread safety.
Smart Images

Figure CN115268889B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software development technology, and in particular to a construction method, callback method, and device for an iOS concurrent animation callback program. Background Art
[0002] In iOS development, animations are often used to improve the user experience, increase the fun and intuitiveness of the app, and create an atmosphere. A single iOS animation can meet most needs, but certain scenarios require multiple styles and numbers of animations to be played concurrently on the same page. This can make it difficult to distinguish animation callbacks, and subsequent logical operations after certain animations end often face great difficulties or even be impossible to perform.
[0003] Currently, the most common solution for iOS to handle high-concurrency animations is to bind the animated view and the animation. Through the logic of binding the animation, when the animation ends, the animation is removed or subsequent operations are performed after the animation, or the animation queue is used to perform implicit binding operations between the animation and the view.
[0004] Existing solutions using animation view binding and animation queues have the following disadvantages:
[0005] 1. Using the view animation binding solution, each animation must be set with a different key (to distinguish the animation). By binding the key to the view, the view must be deleted after the animation ends. Data management must also ensure thread safety, and the implementation complexity is relatively high.
[0006] 2. Using animation queues can ensure that animations are executed in sequence. If the animations are executed at different times, it will be difficult to distinguish animation callbacks. Summary of the Invention
[0007] The purpose of the embodiments of the present application is to provide a construction method, callback method and device for an iOS concurrent animation callback program, which utilizes an extended proxy chain method to separately manage the animation's proxy objects to achieve a one-to-one relationship between proxy and animation, thereby changing the general one-to-many writing method of proxy and animation, increasing the controllability of the animation, and enabling simple, efficient and reliable implementation of high-concurrency animation callbacks.
[0008] In order to achieve the above objectives, the embodiments of the present application are implemented in the following manner:
[0009] In the first aspect, an embodiment of the present application provides a method for constructing an iOS concurrent animation callback program, including: creating a view controller; creating n views in the view controller and adding them to the view controller, where n is a positive integer; creating n animation objects in the view controller and adding them one-to-one to the n views; creating n proxy objects, setting them one-to-one as proxies of the n animation objects, and adding references to the views by the proxy objects, and then using the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is complete.
[0010] In combination with the first aspect, in a first possible implementation method of the first aspect, after creating n views View_i, i = 1, ..., n, n animation objects are created in the view controller and added one-to-one to the n views, including: creating n animation objects Animation_i in the view controller; adding the n animation objects Animation_i one-to-one to the layer layers of the n views View_i through the [view_i.layer addAnimation:Animation_iforKey:@"Animation_i"] method.
[0011] In combination with the first possible implementation method of the first aspect, in the second possible implementation method of the first aspect, n proxy objects are created, set one-to-one as proxies of n animation objects, and references to views of the proxy objects are added, and then the view controller is used as the proxy of each proxy object, including: creating n proxy objects AnimationManager_i; setting the n proxy objects AnimationManager_i as proxies of n animation objects Animation_i one-to-one; adding references to n views View_i for the n proxy objects AnimationManager_i one-to-one; and setting the view controller as the proxy of the n proxy objects AnimationManager_i.
[0012] In the second aspect, an embodiment of the present application provides an iOS concurrent animation callback method, in which a view controller proxies n proxy objects, each proxy object serves as a proxy for a view, and each view is added with an animation object. Each proxy object references the view corresponding to the animation object it proxies, and each proxy object complies with the CAAnimationDelegate protocol, and a proxy method or a block callback method is added to the protocol method. The iOS concurrent animation callback method is applied to any proxy object, including: after the animation object associated with the view proxied by this proxy object is executed, the CAAnimationDelegate protocol is followed to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback; and the view controller is notified of the completion of the animation using the added proxy method or block callback method.
[0013] In the third aspect, an embodiment of the present application provides a device for constructing an iOS concurrent animation callback program, including: a view controller creation unit for creating a view controller; a view creation unit for creating n views in the view controller and adding them to the view controller, where n is a positive integer; an animation object creation unit for creating n animation objects in the view controller and adding them one-to-one to the n views; a proxy object creation unit for creating n proxy objects, setting them one-to-one as proxies of the n animation objects, and adding references to the views by the proxy objects, and then using the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is completed.
[0014] In combination with the third aspect, in a first possible implementation method of the third aspect, after the view creation unit creates n views View_i, i = 1,…, n, the animation object creation unit is specifically used to: create n animation objects Animation_i in the view controller; and add the n animation objects Animation_i one-to-one to the layer layers of the n views View_i through the [view_i.layer addAnimation:Animation_i forKey:@"Animation_i"] method.
[0015] In combination with the first possible implementation method of the third aspect, in the second possible implementation method of the third aspect, the proxy object creation unit is specifically used to: create n proxy objects AnimationManager_i; set the n proxy objects AnimationManager_i as proxies of n animation objects Animation_i one by one; add references to n views View_i for the n proxy objects AnimationManager_i one by one; and set the view controller as the proxy of the n proxy objects AnimationManager_i.
[0016] In the fourth aspect, an embodiment of the present application provides an iOS concurrent animation callback device, in which a view controller proxies n proxy objects, each proxy object serves as a proxy for a view, an animation object is added to each view, and each proxy object references the view corresponding to the animation object it proxies. Each proxy object complies with the CAAnimationDelegate protocol, and a proxy method or a block callback method is added to the protocol method. The iOS concurrent animation callback device is applied to any proxy object, including: a proxy object callback unit, which is used to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback in accordance with the CAAnimationDelegate protocol after the animation object associated with the view proxied by this proxy object is executed; a view controller callback unit, which is used to use the added proxy method or block callback method to notify the view controller that the animation is completed.
[0017] In a fifth aspect, an embodiment of the present application provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method for constructing an iOS concurrent animation callback program described in any one of the first aspect or possible implementation methods of the first aspect, or execute the iOS concurrent animation callback method described in the second aspect.
[0018] In a sixth aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, the method for constructing an iOS concurrent animation callback program according to the first aspect or any possible implementation method of the first aspect is implemented, or the iOS concurrent animation callback method described in the second aspect is implemented.
[0019] Beneficial effects: Create n views in the view controller and add them, create n animation objects in the view controller, and add them to the n views one by one; create n proxy objects, set them as proxies of the n animation objects one by one, and add references to the views of the proxy objects, and then use the view controller as the proxy of each proxy object, where each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is complete. This method can follow the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback after the animation object is executed; use the added proxy method or block callback method to notify the view controller that the animation is complete. By extending the proxy chain and managing the animation's proxy objects separately, we can achieve a one-to-one relationship between proxy and animation, changing the general one-to-many relationship between proxy and animation. This increases the controllability of the animation and allows for simple, efficient, and reliable implementation of high-concurrency animation callbacks.
[0020] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A flowchart of a method for constructing an iOS concurrent animation callback program provided in an embodiment of the present application.
[0023] Figure 2 This is a logic block diagram of the iOS concurrent animation callback program provided in an embodiment of the present application.
[0024] Figure 3 This is a flowchart of the iOS concurrent animation callback method provided in an embodiment of the present application.
[0025] Figure 4 This is a structural block diagram of the device for constructing an iOS concurrent animation callback program provided in an embodiment of the present application.
[0026] Figure 5 This is a structural block diagram of the iOS concurrent animation callback device provided in an embodiment of the present application.
[0027] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of the present application.
[0028] Icons: 10-iOS concurrent animation callback program construction device; 11-view controller creation unit; 12-view creation unit; 13-animation object creation unit; 14-proxy object creation unit; 20-iOS concurrent animation callback device; 21-proxy object callback unit; 22-view controller callback unit; 30-electronic device; 31-memory; 32-communication module; 33-bus; 34-processor. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0030] See also Figure 1 , Figure 1 A flowchart of a method for constructing an iOS concurrent animation callback program provided in an embodiment of the present application.
[0031] In this embodiment, the method for constructing an iOS concurrent animation callback program may include: step S10, step S20, step S30 and step S40.
[0032] To build an iOS concurrent animation callback program, first, step S10 may be performed.
[0033] Step S10: A view controller may be created.
[0034] In this embodiment, a view controller may be created, for example, named ViewController.
[0035] Afterwards, step S20 may be executed.
[0036] Step S20: Create n views in the view controller and add them to the view controller, where n is a positive integer.
[0037] In this embodiment, n views may be created in the view controller and added to the view controller, where n is a positive integer.
[0038] For example, for the case where n=1: a view may be created in the view controller ViewControllerA, named view, and added to the view controller ViewControllerA.
[0039] For example, for the case where n>1: a view may be created in the view controller ViewControllerB, named view_i, and added to the view controller ViewControllerB, where i=1, 2, ..., n.
[0040] After the created view is added to the view controller, step S30 may be executed.
[0041] Step S30: Create n animation objects in the view controller, and add them to the n views in a one-to-one correspondence.
[0042] In this embodiment, n animation objects may be created in the view controller and added to n views in a one-to-one correspondence.
[0043] For example, for the case where n=1: you can create an animation object in the view controller ViewControllerA, name it Animation, and add the animation object Animation to the view layer through the [view.layer addAnimation:Animation forKey:@"Animation"] method.
[0044] For example, if n > 1, you can create n animation objects Animation_i in the view controller and add each one to the corresponding view view_i. Specifically, you can use the [view_i.layer addAnimation:Animation_i forKey:@"Animation_i"] method to add each of the n animation objects Animation_i to the layer of each view View_i. For example, you can create three animation objects Animation_1, Animation_2, and Animation_3, and then add them to the corresponding views view_1, view_2, and view_3, respectively.
[0045] After the n animation objects are added to the n views, step S40 may be performed.
[0046] Step S40: Create n proxy objects, set them as proxies of n animation objects one by one, add references to the views by the proxy objects, and then use the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is completed.
[0047] In this embodiment, n proxy objects may be created and set as proxies of n animation objects one by one. References to views in the proxy objects are added, and the view controller is used as the proxy of each proxy object.
[0048] For the case where n=1: you can create a proxy object, for example, name it AnimationManager, and then set the created proxy object AnimationManager as the proxy of the animation object Animation, and add a reference of the proxy object AnimationManager to the view View, and set the view controller ViewControllerA as the proxy of the proxy object AnimationManager.
[0049] For the case where n > 1: Create n proxy objects, named AnimationManager_i. Then, set each of the n proxy objects AnimationManager_i as a proxy for the n animation objects Animation_i. Add references to the n views View_i for each of the n proxy objects AnimationManager_i. Then, set the view controller ViewControllerB as the proxy for each of the n proxy objects AnimationManager_i.
[0050] Among them, each proxy object follows the CAAnimationDelegate protocol and can implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and the protocol method adds a proxy method or block callback to notify the view controller that the animation is complete.
[0051] The architecture of iOS concurrent animation callback program is as follows Figure 2 As shown, Figure 2 This is a logic block diagram of the iOS concurrent animation callback program provided in an embodiment of the present application.
[0052] For easier understanding, some code is provided here for reference:
[0053]
[0054]
[0055] Related key pseudo code in the view controller
[0056] -(void)showAvatarAnimation{
[0057] / / Animation view
[0058] UIImageView*avatar=[[UIImageView alloc]init];
[0059] / / Animation management agent
[0060] AvatarAnimation*avatarAnimation=[[AvatarAnimation alloc]init];
[0061] / / The proxy for animation management is the controller (self refers to the current page controller)
[0062] avatarAnimation.delegate=self;
[0063] / / Controller adds view
[0064] [self addSubview:avatar];
[0065] / / Create animation
[0066] Animation*pathAnimation=[Animation animationWithKeyPath:@"position"];
[0067] / / Set animation management as animation proxy
[0068] pathAnimation.delegate=avatarAnimation;
[0069] / / Add animation to the view layer
[0070] [avatar.layer addAnimation:pathAnimation forKey:@"betCoinAnimation"];}
[0071] Based on this, you can build an iOS concurrent animation callback program. Based on the iOS concurrent animation callback program, you can run the iOS concurrent animation callback method to implement iOS concurrent animation callback.
[0072] The view controller delegates n proxy objects, each of which acts as a proxy for a view. Each view is added with an animation object. Each proxy object references the view corresponding to the animation object it delegates. Each proxy object follows the CAAnimationDelegate protocol, and the protocol method is supplemented with a proxy method or block callback method. The iOS concurrent animation callback method can be applied to any proxy object.
[0073] See also Figure 3 , Figure 3 Flowchart of the iOS concurrent animation callback method provided by the embodiment of the present application. In this embodiment, the iOS concurrent animation callback method may include step S1 and step S2.
[0074] Step S1: After the animation object associated with the view proxied by this proxy object is executed, follow the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback.
[0075] Step S2: Use the added proxy method or block callback method to notify the view controller that the animation is completed.
[0076] Each proxy object can execute steps S1 and S2. After the animation object associated with the view it proxies for finishes executing, it can follow the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback and use the added proxy method or block callback method to notify the view controller of the animation completion. This greatly improves the controllability of the animation, allowing for simple, efficient, and reliable implementation of highly concurrent animation callbacks.
[0077] See also Figure 4 , Figure 4 The present invention provides a structural block diagram of an iOS concurrent animation callback program construction device 10. In this embodiment, the iOS concurrent animation callback program construction device 10 may include:
[0078] The view controller creation unit 11 is used to create a view controller.
[0079] The view creation unit 12 is used to create n views in the view controller and add them to the view controller, where n is a positive integer.
[0080] The animation object creation unit 13 is used to create n animation objects in the view controller and add them to the n views in a one-to-one correspondence.
[0081] The proxy object creation unit 14 is used to create n proxy objects, set them as proxies of n animation objects one by one, add references to the views by the proxy objects, and then use the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is completed.
[0082] In this embodiment, after the view creation unit 12 creates n views View_i, i=1,…,n, the animation object creation unit 13 is specifically used to: create n animation objects Animation_i in the view controller; and add the n animation objects Animation_i to the layer layers of the n views View_i one by one through the [viewA.layer addAnimation:Animation forKey:@"Animation"] method.
[0083] In this embodiment, the proxy object creation unit 14 is specifically used to: create n proxy objects AnimationManager_i; set the n proxy objects AnimationManager_i as proxies of n animation objects Animation_i in a one-to-one correspondence; add references to n views View_i for the n proxy objects AnimationManager_i in a one-to-one correspondence; and set the view controller as the proxy of the n proxy objects AnimationManager_i.
[0084] See also Figure 5 , Figure 5A structural block diagram of an iOS concurrent animation callback device 20 is provided for an embodiment of the present application. In this embodiment, a view controller delegates to n proxy objects, each of which is a proxy for a view. Each view is assigned an animation object, and each proxy object references the view corresponding to the animation object it delegates. Each proxy object complies with the CAAnimationDelegate protocol, and the protocol method is supplemented with a proxy method or a block callback method. The iOS concurrent animation callback device 20 is applied to any proxy object and may include:
[0085] The proxy object callback unit 21 is used to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback in accordance with the CAAnimationDelegate protocol after the animation object associated with the view proxied by this proxy object is executed.
[0086] The view controller callback unit 22 is used to notify the view controller of animation completion using an additional proxy method or block callback method.
[0087] See also Figure 6 , Figure 6 This is a structural block diagram of an electronic device 30 provided in an embodiment of the present application.
[0088] In this embodiment, the electronic device 30 may be a smart terminal equipped with an iOS operating system, such as a computer, a smart phone, etc., which is not limited here.
[0089] For example, electronic device 30 may include a communication module 32 connected to the outside world via a network, one or more processors 34 for executing program instructions, a bus 33, and various forms of memory 31, such as a disk, ROM, or RAM, or any combination thereof. Furthermore, electronic device 30 may also include a display screen capable of displaying animated objects. Memory 31, communication module 32, and processor 34 may be connected via bus 33.
[0090] Exemplarily, programs are stored in the memory 31. The processor 34 can call and run these programs from the memory 31, thereby implementing the construction method of the iOS concurrent animation callback program or the iOS concurrent animation callback method by running the programs.
[0091] An embodiment of the present application also provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute a method for constructing an iOS concurrent animation callback program, or execute an iOS concurrent animation callback method.
[0092] In summary, the embodiments of the present application provide a construction method, callback method and device for an iOS concurrent animation callback program, which creates and adds n views in the view controller, creates n animation objects in the view controller, and adds them one-to-one to the n views; creates n proxy objects, sets them as proxies of the n animation objects one-to-one, and adds references to the views by the proxy objects, and then uses the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is complete. In this way, after the animation object is executed, the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback can be implemented in accordance with the CAAnimationDelegate protocol; and the added proxy method or block callback method is used to notify the view controller that the animation is complete. By extending the proxy chain and managing the animation's proxy objects separately, we can achieve a one-to-one relationship between proxy and animation, changing the general one-to-many relationship between proxy and animation. This increases the controllability of the animation and allows for simple, efficient, and reliable implementation of high-concurrency animation callbacks.
[0093] In the embodiments provided herein, it should be understood that the disclosed devices and methods may be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units described is merely a logical function division. In actual implementation, other division methods may be used, or some features may be ignored or not performed.
[0094] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.
[0095] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, various modifications and variations of the present application are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for constructing an iOS concurrent animation callback program, characterized in that: include: Create a view controller; Create n views in the view controller and add them to the view controller, where n is a positive integer; Create n animation objects in the view controller and add them to n views one by one; Create n proxy objects, set them as proxies of n animation objects one by one, add references to the views of the proxy objects, and then use the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is completed.
2. The method for constructing an iOS concurrent animation callback program according to claim 1, wherein: After creating n views View_i, i=1, ..., n, create n animation objects in the view controller and add them to the n views one by one, including: Create n animation objects Animation_i in the view controller; Use the [view_i.layer addAnimation:Animation_i forKey:@"Animation_i"] method to add n animation objects Animation_i one by one to the layer of n views View_i.
3. The method for constructing an iOS concurrent animation callback program according to claim 2, wherein: Create n proxy objects, set them as proxies for n animation objects one by one, add references to the views from the proxy objects, and use the view controller as the proxy for each proxy object, including: Create n proxy objects AnimationManager_i; Set n proxy objects AnimationManager_i as proxies of n animation objects Animation_i one by one; Add references to n views View_i for n proxy objects AnimationManager_i one by one; Set the view controller as the delegate of n delegate objects AnimationManager_i.
4. An iOS concurrent animation callback method, characterized in that: The view controller delegates n proxy objects, each of which acts as a proxy for a view. Each view is added with an animation object. Each proxy object references the view corresponding to the animation object it delegates. Each proxy object follows the CAAnimationDelegate protocol, and the protocol method is supplemented with a proxy method or block callback method. The iOS concurrent animation callback method is applied to any proxy object, including: After the animation object associated with the view proxied by this proxy object is executed, it follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback; The view controller is notified of animation completion using an added delegate method or block callback method.
5. A device for constructing an iOS concurrent animation callback program, characterized in that: include: View controller creation unit, used to create view controllers; A view creation unit, configured to create n views in the view controller and add the views to the view controller, where n is a positive integer; An animation object creation unit, used to create n animation objects in the view controller and add them to n views in a one-to-one correspondence; A proxy object creation unit is used to create n proxy objects, set them one by one as proxies of n animation objects, add references to the views by the proxy objects, and then use the view controller as the proxy of each proxy object, wherein each proxy object follows the CAAnimationDelegate protocol to implement the -(void)animationDidStop:(CAAnimation*)anim finished:(BOOL)flag callback, and a proxy method or block callback is added to the protocol method to notify the view controller that the animation is completed.
6. The device for constructing an iOS concurrent animation callback program according to claim 5, characterized in that: After the view creation unit creates n views View_i, where i=1, ..., n, the animation object creation unit is specifically configured to: Create n animation objects Animation_i in the view controller; Use the [view_i.layer addAnimation:Animation_i forKey:@"Animation_i"] method to add n animation objects Animation_i one by one to the layer of n views View_i.
7. The device for constructing an iOS concurrent animation callback program according to claim 6, characterized in that: The proxy object creation unit is specifically used to: Create n proxy objects AnimationManager_i; Set n proxy objects AnimationManager_i as proxies of n animation objects Animation_i one by one; Add references to n views View_i for n proxy objects AnimationManager_i one by one; Set the view controller as the delegate of n delegate objects AnimationManager_i.
8. An iOS concurrent animation callback device, characterized in that: The view controller delegates n proxy objects, each of which is a proxy for a view. Each view is added with an animation object. Each proxy object references the view corresponding to the animation object it delegates. Each proxy object complies with the CAAnimationDelegate protocol, and the protocol method is supplemented with a proxy method or a block callback method. The iOS concurrent animation callback device is applied to any proxy object, including: The proxy object callback unit is used to implement the -(void)animationDidStop:(CAAnimation*)animfinished:(BOOL)flag callback in accordance with the CAAnimationDelegate protocol after the animation object associated with the view proxied by this proxy object is executed; The view controller callback unit is used to notify the view controller of animation completion using an additional proxy method or block callback method.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein, when the program is running, the device where the storage medium is located is controlled to execute the method for constructing an iOS concurrent animation callback program according to any one of claims 1 to 3, or to execute the iOS concurrent animation callback method according to claim 4.
10. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, the method for constructing an iOS concurrent animation callback program according to any one of claims 1 to 3 is implemented, or the iOS concurrent animation callback method according to claim 4 is implemented.
Citation Information
Patent Citations
Method and system for presenting an animated advertisement on a web page
US20010056370A1
Animation generating method and device, and medium for providing program
US20020067363A1