title: Sticky UITableView scrolling in Unity
body: <p>I am building a <code>UITableView</code>-based Unity plugin which will be embedded by game developers into their Unity app. I am using the standard approach with dequeueing reusable cells, and the <code>UITableViewCell</code>s contain simple <code>UILabel</code>s and a <code>UIImageView</code>. The image inside the <code>UIImageView</code> is loaded via an asynchronous request.</p>
  
  <p>There are no usability issues at all when launching the plugin as a standalone Objective-C app (in particular, scrolling works well with no lag) but when inside Unity, there is a "sticky" scrolling issue which arises randomly, i.e. the view scrolls but without inertia. I have not been able to pinpoint the exact actions which cause this behavior, but it happens usually when I scroll very quickly in one direction, or in short movements back and forth. The bug disappears when I scroll the view past the top or bottom (trigger the "bounce" effect, I am guessing this causes some hard refresh).</p>
  
  <p>There is a <em>very</em> similar issue described <a href="http://forum.unity3d.com/threads/113815-quot-Sticky-quot-scrolling-in-UITableView-and-UIScrollView-when-interfacing-Unity-and-Obj-C" rel="nofollow">here</a>. The fix they suggest is to put</p>
  
  <pre><code>#define USE_DISPLAY_LINK_IF_AVAILABLE 0
  </code></pre>
  
  <p>inside the Unity-generated AppController.mm file. Unfortunately, this fix is unfeasible for the game developer who will be integrating our plugin, since it turns off the fastest and most reliable timing solution, and would require a fallback to other timing systems which would cause the game itself to lag or miss a portion of touch and accelerometer events.</p>
  
  <p>I will most likely override <code>drawRect</code> for the <code>UITableViewCell</code>s to reduce rendering time and memory usage, and if that fails, write a version of the plugin in OpenGL. However, I was wondering if anyone had a similar issue and knows a quicker fix, either in Objective-C or inside Unity, that is non-destructive (like the timing fix described above). Thanks very much.</p>