1.首先要先分清实现的过程,目测应该是使用了苹果自带的UIview类方法:
- (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options: (UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completionNS_AVAILABLE_IOS(4_0);
2.那么我们需要在一个view上建立两个uiimageview,来实现相互交替翻转效果。
暂且叫做userIconView,两个imageview叫做,imageview1,imageview2;
3.为了判别哪个imageview在外层,我们设置一个bool变量_isImageView1Up;
4.集成SDImageView第三方库,可以实现同一个view中更换用户头像的翻转效果。
核心代码
-(void)OverTurn360WithTime:(float)time WithImageURL:(NSString *)imageStr{
!_isImageView1Up ? ([imageView1 loadImage:imageStr]) : ([imageView2 loadImage:imageStr]);
[UIView transitionFromView:(_isImageView1Up ? imageView1 : imageView2)
toView:(_isImageView1Up ? imageView2 : imageView1)
duration: time
options: UIViewAnimationOptionTransitionFlipFromLeft+UIViewAnimationOptionCurveEaseInOut
completion:^(BOOL finished) {
if (finished) {
_isImageView1Up = !_isImageView1Up;
}
}
];
}