ScrollView轮回滚动,pageControl

/********************************/

[self.pageControladdTarget:selfaction:@selector(didClickPageControl:)forControlEvents:(UIControlEventValueChanged)];

/*******轮回滚动********/

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

if(scrollView.contentOffset.x==0) {

self.scrollView.contentOffset=CGPointMake(ScreenWidth*4,0);

}

if(self.scrollView.contentOffset.x==ScreenWidth*5) {

self.scrollView.contentOffset=CGPointMake(ScreenWidth,0);

}

/*****图片滚动,改变小点*****/

NSIntegerpageNumber =(long) (scrollView.contentOffset.x-1) /ScreenWidth;

self.pageControl.currentPage= pageNumber;

}

/*****改变小点,图片滚动*****/

-(void)didClickPageControl:(UIPageControl*)pageControl{

CGPointnewPoint =CGPointMake((pageControl.currentPage+1) *ScreenWidth,0);

[self.scrollViewsetContentOffset:newPointanimated:YES];

}

你可能感兴趣的:(ScrollView轮回滚动,pageControl)