Rotary Wheel stopping at every 90 degree sector only iOS

I have made a rotary wheel of 26 sectors. I want the rotary wheel to stop randomly at any of the sectors whereas it is only stopping at every 90 degrees sector (on sector # 0,6,13,20). This is my code snippet.

// an ivar for your class:  BOOL animating;    - (void) spinWithOptions: (UIViewAnimationOptions) options {     // this spin completes 360 degrees every 2 seconds     [UIView animateWithDuration: 0.5f                           delay: 0.0f                         options: options                      animations: ^{                         self.imageToMove.transform = CGAffineTransformRotate(imageToMove.transform, M_PI / 2);                      }                      completion: ^(BOOL finished) {                         if (finished) {                            if (animating) {                               // if flag still set, keep spinning with constant speed                               [self spinWithOptions: UIViewAnimationOptionCurveLinear];                            } else if (options != UIViewAnimationOptionCurveEaseOut) {                               // one last spin, with deceleration                               [self spinWithOptions: UIViewAnimationOptionCurveEaseOut];                            }                         }                      }];  }    - (void) startSpin {     if (!animating) {        animating = YES;        [self spinWithOptions: UIViewAnimationOptionCurveEaseIn];     }     }    - (void) stopSpin {      // set the flag to stop spinning after one last 90 degree increment      animating = NO;  }

Please tell me how to make it stop randomly every time it spins.

Replay

Category: ios Time: 2016-07-31 Views: 3

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.271 (s). 12 q(s)