-
Notifications
You must be signed in to change notification settings - Fork 506
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels