Skip to content

ChenYalun/YAPageView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published