I have this code:
-(void)startRotation:(RDUtilitiesBarRotation)mode { rotationTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(rotateSelectedItem:) userInfo:[NSNumber numberWithInt:mode] repeats:YES]; } -(void)rotateSelectedItem:(NSNumber*)sender { float currAngle = [selectedItem currentRotation]; if ([sender intValue] == RDUtilitiesBarRotationLeft) { [selectedItem rotateImage:currAngle - 1]; } else { [selectedItem rotateImage:currAngle + 1]; } } -(void)stopRotation { [rotationTimer invalidate]; rotationTimer = nil; }
The goal is to start rotating the view while the user holds the button. When the user releases it, the timer stops.
But I give this:
- [__ NSCFTimer intValue]: unrecognized selector sent to instance 0x4ae360
But if I paasing the userInfo class to NSNumber, why do I get a timer?
Thanks.
source share