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

[UIView isAnimating] category method potentially misleading on iOS7 #14

Open
lukeredpath opened this issue Oct 14, 2013 · 4 comments
Open

Comments

@lukeredpath
Copy link

I use the isAnimating category method, defined in UIView+ShelleyExtensions.m to check that nothing is animating before interacting (e.g. tapping). I'm using the Igor query engine and some custom code but I believe Frank has a similar Cucumber step/helper method that uses this too.

As of iOS7, it is possible for certain elements to be "animating" without actually moving if they have some kind of motion effect attached to them. In my particular, action sheets and alerts have a parallax effect applied to them (using the private _UIParallaxMotionEffect class).

There are several ways around this; one would be to discount the above motion effect (or all motion effects) although that probably leaves open edge cases. Any suggestions here?

@lukeredpath
Copy link
Author

Here's the workaround I'm currently using (as I'm not using Shelley, I've copied the category methods into my app's source). Like I say, it's not foolproof, but it does fix my particular issue.

- (BOOL)isAnimating
{
  if (self.layer.animationKeys.count == 1) {
    // it is possible for the only animation to be attached to a view to be
    // a parallax effect (e.g. alerts and action sheets). We can probably
    // safely discount them.
    if (self.motionEffects.count == 1 && [self.motionEffects[0] isKindOfClass:NSClassFromString(@"_UIParallaxMotionEffect")]) {
      return NO;
    }
  }
  return self.layer.animationKeys.count > 0;
}

@seanoshea
Copy link

Will #15 take care of this issue?

@lukeredpath
Copy link
Author

@seanoshea yes it should

@seanoshea
Copy link

OK. Sounds like we just need travis to get Xcode 5/iOS 7 support so and that should get #15 and #14 all taken care of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants