Suppose my app will display some text and thumbnail image on the screen. When the user tap the image, the app will display the larger image whose size is fit the screen, remains the same ratio, just like the UIImageView.contentMode = UIViewContentModeScaleAspectFit. I want to implement such a view transition when display larger image, that is just like when we click a folder locates on the desktop of your Mac computer. When you double click the folder on the desktop, it will open the Finder开发者_如何学JAVA with transition animation. And there is also a backward transition when you close the Finder, the animation just like the Finder window zoom out and fade to the folder located on the desktop. So suppose the folder is my thumbnail image, and the Finder window is my larger image that will display to fit the iphone screen. How to implement such view transition effect?
Hope I state my question clearly.
Thank you.
best regards.
Take a look at CGAffineTransform. Especially the Scale and MakeScale methods. Go to the Developer Documentation in your XCode and run a search. Look at the example projects. Similar view animations can be applied to your imageView.
Very easy effect using CGAffineTransformMakeScale
.
yourImage.alpha = 0;
yourImage.transform = CGAffineTransformMakeScale(3, 3);
[UIView beginAnimations:@"" context:NULL];
[UIView setAnimationDuration:1.0];
yourImage.transform = CGAffineTransformMakeScale(1, 1);
yourImage.alpha = 1;
[UIView commitAnimations];
精彩评论