Latest 0.0.2
Homepage https://github.com/Wayne2Wen/WWObserve
License MIT
Platforms ios 8.0, requires ARC
Dependencies ReactiveObjC
Frameworks UIKit
Authors

License MIT 
CocoaPods 
Support 

Observe whether the subviews are displayed on the screen when the scroll view stops scrolling.

Observe的方法有

  • scrollView代理方法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;

- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;

- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;
  • scrollView实例方法
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;

- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; 

使用

需要被监测的scrollView

[scrollView ww_registerObserve];

在这个scrollView的需要被监测滚动的subviewww_visibleHandler中写入监测代码

@weakify(self);
view.ww_visibleHandler = ^(CGRect viewRect, CGRect containerRect, BOOL stop) {
    @strongify(self);
    NSString *stopStr = stop ? @"🎈End" : @"🌲Begin";
    NSString *str = [NSString stringWithFormat:@"%zd-%@", self.index, stopStr];
    NSLog(@"%@ScrollnViewRect:%@, nContainerRect:%@", str, NSStringFromCGRect(viewRect), NSStringFromCGRect(containerRect));
};

安装

  • CocoaPods安装:

    pod 'WWObserve'
  • 下载ZIP包,将WWObserve资源文件拖到工程中。

其他

本库依赖三方库ReactiveObjC。在使用前,您可以查看示例程序WWObserveDemo

Latest podspec

{
    "name": "WWObserve",
    "summary": "Observe whether the subviews are displayed on the screen when the scroll view stops scrolling.",
    "version": "0.0.2",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Wayne2Wen": "[email protected]"
    },
    "homepage": "https://github.com/Wayne2Wen/WWObserve",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Wayne2Wen/WWObserve.git",
        "tag": "0.0.2"
    },
    "requires_arc": true,
    "source_files": "WWObserve/**/*{h,m}",
    "public_header_files": "WWObserve/Public/*.{h}",
    "frameworks": "UIKit",
    "dependencies": {
        "ReactiveObjC": [
            "~> 3.1.0"
        ]
    }
}

Pin It on Pinterest

Share This