CoverFlowDemo.zip (647.3 KB)
关键代码:
- (void)showImage:(BOOL)animation {
UIImageView *tempImageView;
subviewsArray = [scrollViewsubviews];
if (animation) [UIView beginAnimations:nil context:nil];
for (int i = 0; i < imagesCount; i++) {
tempImageView = (UIImageView *)[subviewsArrayobjectAtIndex:i];
if (i < selectedImage) {
tempImageView.layer.transform =CATransform3DMakeRotation(1,0, 1, 0);
tempImageView.layer.position =CGPointMake(110+imageSize.width /3 * i, 500);
}elseif (i > selectedImage) {
tempImageView.layer.transform =CATransform3DMakeRotation(-1,0, 1, 0);
tempImageView.layer.position =CGPointMake(650+(imageSize.width /3 * i), 500);
}else {
tempImageView.layer.transform =CATransform3DIdentity;
tempImageView.layer.position =CGPointMake(380 +imageSize.width /3 * i, 500);
}
}
if (animation) [UIView commitAnimations];
}