Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimating objects from off screen loss of response
    primarykey
    data
    text
    <p>I have a <code>UIViewController</code>. Within that is a <code>UITableView</code> which is drawn at origin <code>0,0</code>. I also have a <code>UIScrollView</code> that is drawn at <code>0,-80</code> so that it is off screen and not visible. </p> <p>When a menu button is pressed, I animate the <code>UIViewController</code>'s frame down 80px to reveal the <code>UIScrollView</code>. </p> <p>The problem here is that the <code>UIScrollView</code> does not respond at all. </p> <p>If I draw the <code>UIScrollView</code> at say <code>0,0</code>, where it IS visible on load, it works fine. I can even animate it off screen then back on screen with no issue. </p> <hr> <p>Here is how my view looks <em>before</em> animating:</p> <pre><code> _____________________________ | | Frame -&gt; (0,-80, 320, 80) | ScrollView | **Offscreen** |_____________________________| | | &lt;- Original view (0,0,320,480) | | | | | | | | | | | Original View | | | | | | | | | | | | | | | | | | | | | |_____________________________| </code></pre> <hr> <p>When I animate I do the following:</p> <pre><code>[UIView animateWithDuration:0.3 delay:0.0 options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveEaseIn) animations:^{ self.view.frame = CGRectMake(0.0, (self.view.frame.origin.y + container.frame.size.height), self.view.frame.size.width, self.view.frame.size.height); scroll.userInteractionEnabled = YES; } completion:^(BOOL finished) { if (scrollLoaded == NO) { [self loadFavorites]; scrollLoaded = YES; } }]; </code></pre> <hr> <p>Now my view looks like this <em>after</em> animating:</p> <pre><code> _____________________________ | | Frame -&gt; (0, -80, 320, 80) | ScrollView | |_____________________________| | | &lt;- Original view (0, 80, 320, 480) | | | | | | | | | | | Original View | | | | | | | | | | | | | | | |_____________________________| | | | **Offscreen** | |_____________________________| </code></pre> <hr> <p>I have subclassed my <code>scrollView</code> to listen more closely for events:</p> <p><strong>.h</strong></p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface UIScrollView_ExtraTouch : UIScrollView @end </code></pre> <p><strong>.m</strong></p> <pre><code>#import "UIScrollView+ExtraTouch.h" @implementation UIScrollView_ExtraTouch - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesBegan"); [self.nextResponder touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesMoved"); if(!self.dragging){ [self.nextResponder touchesMoved:touches withEvent:event]; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"scrollview touchesEnded"); [self.nextResponder touchesEnded:touches withEvent:event]; } @end </code></pre> <hr> <p>Nothing goes to the log after the animation. Which I <em>think</em> means that since the frame is at <code>-80</code>, it believes it to be off screen, thus not receive any type of action. </p> <p>Is this correct? If so is there a way to fix it?</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. This table or related slice is empty.
    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