Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>UIImageView is just fine for animating about the display (UIViews are lightweight wrappers around CALayers, which are just textures stored on the graphics card), but you do need to use the begin / commit animation block to get smooth animation. Using that, you can retrieve the current position of the view by accessing the backing layer of the UIView and obtaining its presentation layer. Dustin Bachrach has a <a href="http://dbachrach.com/blog/2008/04/07/instantaneous-frame-of-moving-core-animation-views/" rel="nofollow noreferrer">post</a> that describes just how to do this. Basically, the presentation layer is Core Animation's closest approximation to where the actual layer is at any given time, so its frame is the frame of your UIView at that instant.</p> <p>I'm not sure that touch events will find their way to the view as it's moving across the screen, so if you need to have the UIImageView respond to touches you may need to replace it with a CALayer, insert it as a sublayer of your main UIView's layer, and call the hitTest method on the presentationLayer of that main layer. That should return the presentationLayer of your moving layer if it was clicked on, or the background layer if not.</p> <p>Honestly, I wouldn't go with OpenGL unless you absolutely had to for performance reasons, because it is a lot harder to code for than what Core Animation provides you with UIViews and CALayers. I've been able to animate 50 moving translucent layers at 60 FPS (100 at 30 FPS) using just UIViews and CALayers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload