Demo function: Use UIimageView to achieve 360-degree rotation.
Demo Description: iPhone6.1 is successfully tested. The main code is FVImageSequence. m. In the touchesMoved event, the rotation effect is generated by replacing the image of UIimageView.
Demo screenshot:
Demo main code:
[Html]
-(Void) touchesMoved :( NSSet *) touches withEvent :( UIEvent *) event {
[Super touchesMoved: touches withEvent: event];
UITouch * touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView: self];
Int location = touchLocation. x;
// Determine the direction of rotation based on the moving offset.
If (location <previous)
Current + = increment;
Else
Current-= increment;
Previous = location;
// Specifies the image critical point. All images in the image folder in the demo are taken from different angles. You can display these images in sequence to achieve a 360 rotation effect.
If (current> numberOfImages)
Current = 0;
If (current <0)
Current = numberOfImages;
NSString * path = [NSString stringWithFormat: @ "% @ % d", prefix, current];
NSLog (@ "% @", path );
Path = [[NSBundle mainBundle] pathForResource: path ofType: extension];
UIImage * img = [[UIImage alloc] initWithContentsOfFile: path];
// Set the image of UIimageView as a new image to achieve 360-degree rotation
[Self setImage: img];
[Img release];