Am trying to do this animation on a view, To Scale it to (0,0) then Move this frame using CGRectMake method and scale it back to (1,1). So I used the following Code to do this
-(void)startWalkAnimationStartWalkingBtnViewScaleToZero{
CGAffineTransform transform = StartWalkBtnView.transform;
StartWalkBtnView.transform=CGAffineTransformScale(transform,1.0f, 1.0f);
[UIView animateWithDuration: 0.7
delay: 0.6
options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{ StartWalkBtnView.transform = CGAffineTransformScale(transform, 0.0f, 0.0f);
}
completion:^(BOOL finished){
[UIView animateWithDuration:0.0
delay:0.0
options: UIViewAnimationOptionCurveEaseIn
animations:^{
StartWalkBtnView.frame=CGRectMake(92, 270, 120, 121);
}
completion:^(BOOL finished){
StartWalkBtnView.transform=CGAffineTransformScale(transform,0.0f, 0.0f);
[UIView animateWithDuration: 0.7
delay: 0.8
options: (UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
animations:^{ StartWalkBtnView.transform = CGAffineTransformScale(transform, 1.0f, 1.0f);
}
completion:^(BOOL finished){}
];
}];
}
];
}
But After trying to run this Animation I got the following error in the Console.
Jun 17 12:02:49 Kareem.local MyAppName[3157] <Error>: CGAffineTransformInvert: singular matrix.
I googled for this too much, and have tried all the solutions provided (Scale Near to zere Value,...) but nothing worked, Do any one has an idea for solving this. Thanks for help
UPDATE: I found that the problem in the following line:
StartWalkBtnView.frame=CGRectMake(92, 270, 120, 121);
But Actually I don't know how to solve the problem, But when I removed this line It scaled to zero then back from zero normally without any errors