Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autolayout is used in conjunction with CATransform3D #796

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions iCarousel.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iCarousel",
"version": "1.8.3",
"name": "iCarousel-CATransform3D",
"version": "1.0.1",
"license": {
"type": "zlib",
"file": "LICENCE.md"
Expand All @@ -11,8 +11,8 @@
"Nick Lockwood": "[email protected]"
},
"source": {
"git": "https://github.com/nicklockwood/iCarousel.git",
"tag": "1.8.3"
"git": "https://github.com/xhzengAIB/iCarousel.git",
"tag": "1.0.1"
},
"source_files": "iCarousel/iCarousel.{h,m}",
"requires_arc": true,
Expand Down
9 changes: 7 additions & 2 deletions iCarousel/iCarousel.m
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,13 @@ - (void)transformItemView:(UIView *)view atIndex:(NSInteger)index
CATransform3D transform = [self transformForItemViewWithOffset:offset];

//transform view
view.superview.layer.transform = transform;

CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
basicAnimation.fillMode = kCAFillModeForwards;
basicAnimation.removedOnCompletion = NO;
basicAnimation.duration = 0.15;
basicAnimation.toValue = [NSValue valueWithCATransform3D:transform];
[view.superview.layer addAnimation:basicAnimation forKey:nil];

//backface culling
BOOL showBackfaces = view.layer.doubleSided;
if (showBackfaces)
Expand Down