Note that there are some explanatory texts on larger screens.

plurals
  1. PONested UIScrollViews
    primarykey
    data
    text
    <p>I have a mainScrollView scrolling horizontally with photos added to it and mainScrollView's contentSize is set according to the number of photos. </p> <p>To achieve the effect of scrolling to the end and swiping in a UIView with display info for user, I added the overlayScrollView to mainScrollView's subviews. </p> <p>overlayScrollView contains the contentView positioned outside the frame.</p> <pre><code>CGRect frame = self.mainScrollView.frame; frame.origin.x = CGRectGetWidth(frame) * (count-1); UIScrollView *overlayScrollView = [[UIScrollView alloc] initWithFrame:frame]; [self.mainScrollView addSubview:overlayScrollView]; // moves contentView one frame beyond frame.origin.x = CGRectGetWidth(frame); UIView *contentView = [[UIView alloc] initWithFrame:frame]; contentView.backgroundColor = [UIColor redColor]; [overlayScrollView addSubview:contentView]; overlayScrollView.contentSize = CGSizeMake(overlayScrollView.frame.size.width * 2, overlayScrollView.frame.size.height); overlayScrollView.pagingEnabled = YES; </code></pre> <p>I searched through SO on nested UIScrollViews and so subclassed UIScrollView for mainScrollView with the following method: </p> <pre><code>- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { for (UIView *child in self.subviews){ if([child isMemberOfClass:[UIScrollView class]]) if(CGRectContainsPoint(child.frame, point)) return child; } return self; } </code></pre> <p>But it doesn't work. My code could be wrong. hitTest did return child (overlayScrollView) but did not scroll. Any suggestions how to code this?</p>
    singulars
    1. This table or related slice is empty.
    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. 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