-
Notifications
You must be signed in to change notification settings - Fork 497
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
Shake Animation View - Starting Position wrong with Auto layout #23
Comments
Ok it seems this problem occurs with other animations too - try Pop with a delay to see it's starting position. So the question is, is this an issue with Auto Layout and missing constraints or an issue with Canvas? |
hey @wuf810 I have the exact same issue too, not in the example app but when I'm implementing the pop animation into an app im developing right now. The starting position is also wrong and then it flips to the upper left. |
Hi @gizmou Sorry I've not done enough experimenting to confirm your other issue. I'll check soon NB The issue is only visible in the Demo app by
I hope one of the developers can investigate this issue and offer a fix. Thanks, M. |
Proposed fix: For each animation, before any transform is applied, add the following line: view.translatesAutoresizingMaskIntoConstraints = YES; This seems to fix the issue regardless of whether Auto Layout is set to On or Off for the ViewController. However I do not know enough about auto layout as to why this works and whether there would be other side effects. |
Thanks for your fix! When I'm setting some of the animations directly the interface builder (so the animaions get executed when I open the app) where do I put "view.translatesAutoresizingMaskIntoConstraints = YES;" ? In the "viewWillAppear" method? |
I'm not sure at what point the runtime attributes execute but yes worth trying in viewWillAppear. You will obviously need an outlet to the view self.viewToAnimate. translatesAutoresizingMaskIntoConstraints = YES NB I am hoping the Project Owners will add this to each animation itself so we don't have to do this ourselves. |
Ok I will try that later today and will report back how it went. |
Thanks, do you guys want to make a pull request for this fix so it can be attributed? |
I'm not worried about attribution and to be honest completely over run at the moment with other work. So if you want to make the changes yourself, I am happy for you to do so. If not it will take me some time. Thanks again for a great project. |
@wuf810 @jamztang alright I finally tried it (sorry it took so long). I tried your suggestion with self.splashView.translatesAutoresizingMaskIntoConstraints = YES; but it doesn't really work. I try to do an animation right at the start when the application launches. I have a view and an outlet to this view (called splashView). Then in the viewDidLoad method I try to add a picture to this view like so: UIImage *image = [UIImage imageNamed:@"somepicture.png"]; And then I try to animate: CSAnimationView *animationView = [[CSAnimationView alloc] initWithFrame:CGRectMake(27, 263, 268, 83)]; The picture shows but it doesnt animate at all. Did I miss something in my code? Thanks for taking the time. |
It seems that the animationView you create is separate from the imageView. Try adding your imageView as a subview of animationView @gizmou |
@jamztang Thank you, but I've already tried that. You mean like this? |
Ok, so far in my understanding Autolayout requires to animate the constant variable, now Canvas were animating frames and positions. To make Canvas support constraints, we probably have to let CSAnimationView knows which constant to animate. I don't quite have a solution right now to keep things simple yet.. It most probably require a major update on how it's currently written, which I am sorry that mostly won't happen too soon due to our current availability. So for now the best description is to tag that current version of Canvas can only work well without autolayout. |
Got a chance to get to my computer to work on Canvas, I've created a branch it seems like I don't have the issue @gizmou mentioned about. Confirmed that @wuf810 solution works on iOS 7 but it will warns about constraints ambiguity everytime Canvas tried to animate a view. Will take a bit more time for a better solution like stated above. |
Hi, I have some troubles whit Canvas when I try to open PPT, PDF or another kind of files, when I login as a student and download some of the archive, every of them are broken, Power point says that the archive is Corrupt, can you help me please? |
1.5 years later and still no fix for this.. Project looks all but abandoned. @jamztang would you be interested in letting someone else maintain this project? |
Hi guys |
Hi,
With a Shake animation embedded in a ViewControler that has Auto Layout enabled. the starting position for the Shake Animation view is incorrect.
Best way to see this in action is to take the demo app, turn on Autolayout for the Animnation Table View Controller. For the Shake view itself, change the Delay attribute to 4 seconds.
Now when you run the app, you will see the Shake view is offset to the left - probably it's starting position for the shake but this should not happen until the animation is active i.e. after the animation actually starts?
The text was updated successfully, but these errors were encountered: