我试图在视图上执行此动画,将其缩放到(0,0)然后使用CGRectMake方法移动此帧并将其缩放回(1,1).所以我使用以下代码来执行此操作
-(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){}
];
}];
}
];
}
Run Code Online (Sandbox Code Playgroud)
但在尝试运行此动画后,我在控制台中收到以下错误.
Jun 17 12:02:49 Kareem.local MyAppName[3157] <Error>: CGAffineTransformInvert: singular matrix.
Run Code Online (Sandbox Code Playgroud)
我用Google搜索了太多,并尝试了所提供的所有解决方案(Scale Near to zere Value,...)但没有任何效果,任何人都有解决这个问题的想法.感谢帮助
更新: …
我正在开发一个应用程序,可以在将手机放在裤子口袋里的同时计算用户的步数。而且我需要知道哪个更好使用,应该使用加速度传感器还是GyroScope传感器。我也尝试过加速度传感器,但它可以工作,但我要检查GyroScope是否对该功能或加速度计更准确?在此先感谢您的帮助。