iOS开发 差间距滚动

CGFloat fView_Height(UIView *aView) {

  return aView.frame.size.height;

}

CGFloat fView_Width(UIView *aView) {

  return aView.frame.size.width;

}

// x方向的比例

#define DX_Proportion [UIScreen mainScreen].bounds.size.width/(750/2.)

// y方向的比例

#define DY_Proportion  [UIScreen mainScreen].bounds.size.height/(1334/2.)

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

  CGFloat offsetY = scrollView.contentOffset.y;

  if (scrollView == self.tableView) {

    if (offsetY <= self.originY) {

      CGFloat cha = self.originY - offsetY;

      CGFloat y = self.originY;

      y = self.originY - cha*0.5;

      self.imageScrollView.frame = CGRectMake(0, y, fView_Width(self.groundView), fView_Width(self.groundView));

    }

    else {

      CGFloat cha = offsetY - self.originY;

      CGFloat y = self.originY + cha*0.5;

      self.imageScrollView.frame = CGRectMake(0, y, fView_Width(self.groundView), fView_Width(self.groundView));

    }

  }

}

原文地址:https://www.cnblogs.com/diweinan/p/6213994.html