Skip to content

yxw851027/DPCycleScrollView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DPCycleScrollView

一个可以循环滚动的ScrollView.

使用示例:

DPCycleScrollView *scrollView = [[DPCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 200)];
scrollView.delegate = self;
scrollView.datasource = self;
[self.view addSubview:scrollView];

#pragma mark - DPCycleScrollViewDatasource
- (NSInteger)numberOfPagesInCycleScrollView:(DPCycleScrollView *)csView
{
	return 3;
}

- (UIView *)cycleScrollView:(DPCycleScrollView *)csView pageAtIndex:(NSInteger)index
{
	UIImageView *imageView = [[UIImageView alloc] initWithFrame:csView.bounds];
	imageView.contentMode = UIViewContentModeScaleAspectFill;
	imageView.clipsToBounds = YES;
	imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.jpg", 	@(index + 1)]];

	return imageView;
}

#pragma mark - DPCycleScrollViewDelegate
- (void)cycleScrollView:(DPCycleScrollView *)csView didScrollToPageAtIndex:(NSInteger)index
{
	NSLog(@"didScrollToPageAtIndex:%@", @(index));
}

- (void)cycleScrollView:(DPCycleScrollView *)csView clickPageAtIndex:(NSInteger)index
{
	NSLog(@"clickPageAtIndex:%@", @(index));
}

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors