Animated UIWebView does not respond to touches during animation
Asked Answered
F

1

13

At the moment, I'm animating a UIWebView from the bottom of the screen to the top. As the UIWebView animates upwards it becomes untouchable for 50-80% of the duration time.

If I tap the UIWebviews ending destination, or model layer, the taps are registered and the Webview responds appropriately.

Why is this? And what solutions are there for tapping moving/animating UIWebViews?

To further exemplify this, I have created a side project that shows a UIWebView animating upwards. The purple squares represent touch events on the presentation layer, while the blue squares represent touch events outside of the presentation layer.

https://github.com/AdamBCo/UIWebView-Animation-Issues

As seen in the example, UIViewAnimationOptionAllowUserInteraction is set in the UViewAnimation block.

Frodin answered 28/4, 2016 at 23:29 Comment(3)
Seems like the same issue you had on another question about becoming first responder during animation. The solution will be along the same lines.Cutpurse
How is it that this question (which is okay but nothing special) has earned 5 up-votes out of 10 views so far? Seems sort of unusual.Cutpurse
@Cutpurse In the previous example it was a UITextField animating upwards, so I could easily create a hit test and make the textfield the first responder. Since this example is a UIWebView, I'm not able to send a tap event to it.Frodin
A
0

A UIWebView is complicated layout of web elements. To redraw that during animation there is simply not enough time available to entirely redraw the UIWebView, keep the controls in it available for interaction and do the animation.

However there are some settings for this inside a CALayer on what to do with its contents when animating it. I would start looking into that.

Aleppo answered 30/4, 2016 at 8:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.