ChenYalun / YAPageView

Paged scrollView with custom paging width and inset.

Home Page:https://blog.chenyalun.com/2019/08/07/开源项目:YAPageView/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YAPageView

Usage

  • Paged scrollView with custom paging width and inset, e.g:

Local image array

    YAPageView *pageView = [[YAPageView alloc] initWithFrame:CGRectMake(0, 200, kScreenWidth, 200) controller:self pageWidth:300 pageInset:20];
    pageView.imageArray = @[
        [UIImage imageNamed:@"1"],
        [UIImage imageNamed:@"2"],
        [UIImage imageNamed:@"3"],
        [UIImage imageNamed:@"4"],
    ];

Network image url array

    // If you use SDWebImage, you can set it as follows:
    pageView.configImageHandler = ^(UIImageView *imageView, NSURL *url) {
       [imageView sd_setImageWithURL:url];
    };
    
    pageView.imageURLArray = @[
        [NSURL URLWithString:@"https://picsum.photos/id/230/350/200"],
        [NSURL URLWithString:@"https://picsum.photos/id/231/350/200"],
        [NSURL URLWithString:@"https://picsum.photos/id/232/350/200"],
        [NSURL URLWithString:@"https://picsum.photos/id/233/350/200"],
        [NSURL URLWithString:@"https://picsum.photos/id/234/350/200"],
        [NSURL URLWithString:@"https://picsum.photos/id/235/350/200"]
    ];

Automatic Loop Play

    pageView.timeInterval = 3.f;

Click event callback

    __weak typeof(self) weakSelf = self;
    pageView.tapHandler = ^(NSUInteger idx, UIImage *img, NSURL *url) {
       __strong typeof(weakSelf) self = weakSelf;
       [self.navigationController popViewControllerAnimated:YES];
    };

Demo

Article

开源项目:YAPageView

Author

Yalun, Chen

License

YAScrollPlaceView is available under the MIT license. See the LICENSE file for more info.

About

Paged scrollView with custom paging width and inset.

https://blog.chenyalun.com/2019/08/07/开源项目:YAPageView/

License:MIT License


Languages

Language:Objective-C 100.0%