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

iOS: add view.stopAnimation() parity #14144

Open
1 task done
m1ga opened this issue Nov 16, 2024 · 2 comments
Open
1 task done

iOS: add view.stopAnimation() parity #14144

m1ga opened this issue Nov 16, 2024 · 2 comments
Assignees
Labels
feature ios needs triage This issue hasn't been reviewed by maintainers

Comments

@m1ga
Copy link
Contributor

m1ga commented Nov 16, 2024

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

On Android I've added #13743 to run view.stopAnimation(); in order to stop an animation (check the ticket for example code). It would be great to have that on iOS too.

I've found https://developer.apple.com/library/archive/qa/qa1673/_index.html and added this to TiUIView:

-(void)pauseLayer:(CALayer*)layer
{
    CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
    layer.speed = 0.0;
    layer.timeOffset = pausedTime;
}

which works fine and will stop the animation at the point it currently is. But I wasn't able to start a new animation from the start again. Not a resume but just the normal view.animate() to start the animation from the start again (that's how Android works).

Any idea how to reset it? I've tried to set the speed back to 1 and the time to 0, also tried [self.layer removeAllAnimations]; but it didn't reset it.

Solution

Add a way to stop/pause the animation and when you call view.animate() again it should start again.

Alternatives

No response

Platforms

iOS

@m1ga m1ga added feature needs triage This issue hasn't been reviewed by maintainers ios labels Nov 16, 2024
@AbdullahFaqeir
Copy link
Contributor

@m1ga can you assign this to me

@m1ga
Copy link
Contributor Author

m1ga commented Nov 16, 2024

Awesome! Check the code in #13743 on Android to see what it does (press animate and in the middle of the animation press cancel to make it stop at that point).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ios needs triage This issue hasn't been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants