objective c - create animated circle and rectangle in uiview -
I have to create some animated shapes in my iPhone app (with encoded), like this (,) first a circle Should increase and its radius should be low; 0 to X and Visevas; Second, the length of a rectangle 0 to X is increased and the vixors. The shapes should be animated infinitely ... unless the user taps some buttons to stop animation at some point. How can I get those special draws and animations? What is the best way to achieve that? And how to stop them? Many thanks for any advice.
In my case I had to alert the movement of the SubViews of my UIView object and I completed it like this Did: Configure continuous animation to break into logical parts, animate animate and animate the animation to start another animation. Below you see my code (What is it that is placed across a circle on a circle with the circle that takes the lesson subviews).
- (zero) Animate Part: (NSString *) Animation Ended: (NSN * *) End Context: (Zero *) Reference {// There is a NSN reference in which the angle to CGFLOT Displacement is left to turn on [[Tracksat current display ontrack: drag.track index]; NSMutableDictionary * contextDict = (NSMutableDictionary *) reference; Move * move = (move *) [reference object: ANIMCTX_MOVE]; // nsnm * direction = (nsnm *) [reference object object: ANIMTXx_dression]; Printf ("& gt; EVC Animation Part: Display:% 3.3F", Displacement); If (FABS (displacement) & lt; 0.1) {printf (", ending animation \ n"); // This is the last piece of animation [trackasat poramawaw ontrack: move. Trackarf]; [Self updating piecesAimmedModel]; Self.animationContext = Nil; } And {CGFloat dir = Displacement == 0? 0: Displacement / FABS (displacement); CGFloat Delta = NIMII DeltaStation * dir; Printf ("EVC Anime Part: Delta:% 3.3 F \ n", Delta); CGFloat newDelta = FABS (delta) & lt; FABS (displacement)? Delta: - Displacement; [TrackSet registerMoveOnTrack: by drag.trackIndex: newDelta]; [UIView Start Permissions: ANIID Reference: Reference]; [UIView Set Animation Duration: 0.1]; [UIView Set Animation Crow: UIViewAnimationCurveLinear]; [UIView Set Delegate Animation: self]; [UIView Set AnimationDesettop Selector: @Selector (Animation Part: Finish: Reference :)); [Self update PiecesFromTrack: drag.trackIndex]; [UIView commitAnimations]; } Printf ("& lt; EVC animatePart \ n"); } As you can see, set UIView methods to specify: and animation animation from Safe: Used to configure its animation after using a certain method after calling goes. This is the way the selector selected from here. It seems like a recursive method (this is also a condition of a stop, like regenerative methods normally), but it is not. So there is no worry about stack overflow ;-) For completeness, I use the method below to kickstart this animation (literally copied from my code).
- (zero) animateMove: (Move *) Move direction: (integer) direction {printf ("> EVC animateMove:% d \ n", direction * move.station); NSMutableDictionary * dict = [Object with NSMutableDictionary dictionary: Step for the nail: ANIMCTX_MOVE]; [Dict set object: [with NSNM number number: direction] for: ANIMTXx_denction]; Self.animationContext = dict; // [Tracksat OpenMovOntrack: Move. Trackarf]; / This step has already been done in the model, but the UI has not yet been reflected / we do not have to call Tracksat's Open MowOntrack and close-motionOntraCrack / Animation, we initially used the current displacement of the track The set was set in that set, then in a series of animated steps, we gradually subtract that displacement from zero, while showing the intermediate results in the // UICGFloat Drive Displacement = (CGFLOT) (Transfer Station); [TrackSet RegisterMoveOntrack: Move. Trackarf: conduction displacement]; [Self-demonstration: @ "displacement permission" ended: [nsnumber numberatah: 0] reference: dictionary]; Printf ("& lt; EVC animem: \ n"); }
Comments
Post a Comment