# A small iOS scrolling demo inspired by Zhe800

Language: en
Canonical: [A small iOS scrolling demo inspired by Zhe800](<https://allluckly.cn/en/journal/2015-06-15-a-small-ios-scrolling-demo-inspired-by-zhe800/>)
中文：[中文 HTML](<https://allluckly.cn/uiscrollview/%E7%B1%BB%E4%BC%BC%E6%8A%98800%E5%8A%9F%E8%83%BD%E4%B8%AD%E7%9A%84%E4%B8%80%E4%B8%AA%E5%B0%8FDemo>)
English: [English HTML](<https://allluckly.cn/en/journal/2015-06-15-a-small-ios-scrolling-demo-inspired-by-zhe800/>)
Published: 2015-06-15T00:00:00+08:00
Modified: 2026-10-23T10:34:09+08:00

Uses a Zhe800-style scrolling interaction to demonstrate recording contentOffset when dragging begins and comparing offsets in scroll callbacks to determine direction. An example project shows how the interface elements respond together.

The original does not clearly identify an author. Retained as a historical article.

English translation of the [Chinese original](<https://allluckly.cn/uiscrollview/%E7%B1%BB%E4%BC%BC%E6%8A%98800%E5%8A%9F%E8%83%BD%E4%B8%AD%E7%9A%84%E4%B8%80%E4%B8%AA%E5%B0%8FDemo>), translated on 2026-10-23. The article body uses automated translation; app descriptions, historical reading notes and video subtitles receive separate editorial checks. Original publication dates, attribution, code and version notes are retained.

**Before you read** This technical note dates from 2015–2017. The examples have not been rerun as part of this archive update. Read API, dependency and tool details in the context of the original publication date.

> "The beginning is the most important part of the work." Plato

– Core code –

```css
-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView{

    //使用的时候用全局变量
    CGFloat lastContentOffset = scrollView.contentOffset.y;
}


-( void )scrollViewDidScroll:( UIScrollView *)scrollView {
    
    if (scrollView.contentOffset.y < lastContentOffset )
    {

        //向上
        NSLog(@"向上");

    } else if (scrollView. contentOffset.y >lastContentOffset ){
        //向下
        NSLog(@"向下");
    }
}
```

> [Click here → download the demo](<https://github.com/AllLuckly/LBMoviesPossession>)

![(LBMoviesPossession)](<https://github.com/AllLuckly/LBMoviesPossession/blob/master/Move.gif?raw=true>)

