Stop rotation

Discussion in 'iOS Programming' started by x12, May 27, 2009.

  1. x12 macrumors newbie

    May 20, 2009
    i have a uiimageview rotating when another is touched using a timer to rotate 360d, the first image touched will disappear and image3 will appear i dont know how to make it stop rotating when image3 is touched can anyone help

    UITouch *touch = [touches anyObject];
    	if ([touch view] == image2){
    		radians = -360 * M_PI / 180;
    		[image2 removeFromSuperview];	
    		[self.view addSubview:image3];
    	    [UIView beginAnimations:nil context:nil];
    		[UIView setAnimationDelegate:self];
    		[UIView setAnimationDuration:1];
    		[UIView setAnimationRepeatCount:1e100f];
    		[UIView setAnimationCurve:UIViewAnimationCurveLinear];
    		timer = [ NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector(rotation:) userInfo: nil repeats: YES ];
    		[UIView commitAnimations];
    this is the code for image2 touch to start the rotation i have nothing in the image3 touch yet as i dont know where to start with it i have been searching online for a good while now for this can anyone help
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Maybe try searching through the class Reference for NSTimer. Especially the second last paragraph in the Overview section.
  3. x12 thread starter macrumors newbie

    May 20, 2009

Share This Page