Note that there are some explanatory texts on larger screens.

plurals
  1. PONested UITableViews: a way to scroll both the outer vertical UITableView and a child horizontal UITableView at the same time?
    primarykey
    data
    text
    <p>When you're working with an atypical nested UITableViews setup - where you have an outer vertical UITableView that hosts 90° rotated UITableViews (see: <a href="https://stackoverflow.com/questions/3179683/looking-for-a-ui-library-to-present-data-horizontaly-in-ios">Looking for a UI library to present Data horizontaly in iOS</a> ): is there a way to make iOS process vertical <em>and</em> horizontal touches <em>at the same time</em>?</p> <p>I found that iOS is very clever in processing touches: horizontal touches make the relevant horizontal UITableView scroll, while a vertical swipe makes the outer UITableView scroll. Perfect.</p> <p>Only, I'd love to be able to move my finger diagonally and see the outer UITableView <em>and</em> the inner UITableView scroll at the same time. </p> <p>I tried a few approaches (playing with canCancelContentTouches, delaysContentTouches, and touch messages) but I haven't found a way to make this happen.</p> <p>EDIT: Here's a XCode4 project that shows this behavior: <a href="http://marcanton.io/other/stackoverflow/nestedtableviews.zip" rel="nofollow noreferrer">http://marcanton.io/other/stackoverflow/nestedtableviews.zip</a></p> <p>EDIT: I submitted this issue to Apple Developer Technical Support, here's their reply:</p> <blockquote> <p>Thank you for writing to Apple Worldwide Developer Technical Support. I am responding to your inquiry concerning touch events in embedded UITableViews.</p> <p>Typically this is an approach that is not recommended. The issue is that UITableView inherits from UIScrollView and as stated in the documentation for UIScrollView:</p> <p>"Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled."</p> <p><a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html%23//apple_ref/occ/cl/UIScrollView" rel="nofollow noreferrer">http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html%23//apple_ref/occ/cl/UIScrollView</a></p> <p>So that this time, there is not a workaround for getting both to scroll at the same time.</p> <p>I recommend that you file an enhancement request at <a href="http://developer.apple.com/bugreporter/" rel="nofollow noreferrer">http://developer.apple.com/bugreporter/</a> detailing what you would like to see us add in a future release.</p> </blockquote> <p>Still, I think that there has to be a way to enable this functionality, although I understand that this is not recommended. In fact, Apple does not even recommend hosting UITableViews inside another UITableView, but with the exception made above, it works quite beautifully. I'll keep this question updated with our collective findings.</p> <p>EDIT: There actually is a way, detailed here: <a href="http://marcanton.io/blog/nested-orthogonal-tableviews/" rel="nofollow noreferrer">http://marcanton.io/blog/nested-orthogonal-tableviews/</a></p>
    singulars
    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. COIt sounds like the design is one that is not typical. Is there another way to solve the problem? As I mentioned in my answer, the interpretation of touch events is very challenging based on the design of cocoa touch and even if you submit a bug to Apple, it likely won't be fixed. Are you simply trying to show a UITableView in horizontal mode? Maybe if it's broken down into pseudo requirements a new design could be brainstormed.
      singulars
    2. COI edited my question to reflect the atypical nature of this setup. I thought it was a common trick, but it's not. To answer your comment: the requirement here is having a scrollable grid whose lines can be scrolled independently from each other. As each cell will be an image, it is critical that only visible cells are created and shown - in a UITableViewDataSource fashion. Smooth scrolling is also required - exactly what a UIScrollView provides. Re-implementing everything from scratch is something I'd love to avoid, if at all possible.
      singulars
    3. COI'd like to add that with the above exception (you cannot scroll horizontally _and_ vertically at the same time), it is amazing how well UITouch reacts to swipes by moving the appropriate view.
      singulars
 

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