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

animation repeat count doesn't work in GMGridViewCell #211

Open
codeIreneFFM opened this issue Apr 12, 2017 · 0 comments
Open

animation repeat count doesn't work in GMGridViewCell #211

codeIreneFFM opened this issue Apr 12, 2017 · 0 comments

Comments

@codeIreneFFM
Copy link

codeIreneFFM commented Apr 12, 2017

Great project,for sure. But I have an issue when adding custom view on the GMGridViewCell object and try to perform an animation. I add one rotation animation on my image view. This image view is added on a GMGridViewCell. Animation.repeatcount is set to max ,however the repeat count is random. Could you please give me an answer how to fix this ?

  • (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index
    {
    GMGridViewCell *cell = [gridView dequeueReusableCell];
    cell = [[GMGridViewCell alloc] init];
    cell.backgroundColor = [UIColor colorWithHexStr:@"#f5f5f5" alpha:1];
    NSString *sceneStr= [self.scenesArray objectAtIndex:index];
    AndLinkNewRootSceneItemView *sceneItemView = [[AndLinkNewRootSceneItemView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height) scene:sceneStr];
    [cell addSubview:sceneItemView];
    [self.sceneItemViewList addObject:sceneItemView];
    return cell;
    }

#import "AndLinkNewRootSceneItemView.m"
-(void)addanimation{
CABasicAnimation *animation = [self spinAnimationWithDuration:1.0 clockwise:YES repeat:YES];
animation.delegate = self;
[self.curSceneImageView.layer addAnimation:animation forKey:@"rotationAnimation"];
}

  • (CABasicAnimation *)spinAnimationWithDuration:(CGFloat)duration clockwise:(BOOL)clockwise repeat:(BOOL)repeats
    {
    CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    anim.toValue = clockwise ? @(M_PI * 2.0) : @(M_PI * -2.0);
    anim.duration = duration;
    anim.cumulative = YES;
    //anim.autoreverses = YES;
    anim.removedOnCompletion = NO;
    anim.repeatCount = repeats ? CGFLOAT_MAX : 0;
    return anim;
    }

the CGFLOAT_MAX doesn't work.

@codeIreneFFM codeIreneFFM changed the title animation repeat count doesn't work animation repeat count doesn't work in GMGridViewCell Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant