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.

Aleksander Azizi
  • 9,829
  • 9
  • 59
  • 87
Adam Cooper
  • 867
  • 1
  • 6
  • 23
  • Seems like the same issue you had on another question about becoming first responder during animation. The solution will be along the same lines. – danh Apr 28 '16 at 23:44
  • 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. – danh Apr 28 '16 at 23:45
  • @danh 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. – Adam Cooper Apr 28 '16 at 23:52

1 Answers1

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.

I make my mark
  • 841
  • 6
  • 13