Paging UIScrollView with peeking neighbor pages

后端 未结 3 522
Happy的楠姐
Happy的楠姐 2020-12-13 22:38

Look at the App Store app, on either the iPhone or the iPad, specifically the piece on the screen of app details that shows screenshots. The screenshot viewer shows you the

3条回答
  •  情书的邮戳
    2020-12-13 22:42

    Don't forget to forward the touches to the scrollview subviews if you want your content to stay interactive outside the bounds.

    The following example is true if you've put your scrollview content in an extra container. If this isn't the case, the loop over the subviews and return the one that gets hit by your touch.

    - (UIView*)hitTest:(CGPoint)pt withEvent:(UIEvent*)event 
    {
        UIView *contentView = [self.subviews count] ? [self.subviews objectAtIndex:0] : nil;
        return [contentView hitTest:pt withEvent:event];
    }
    

提交回复
热议问题