UIScrollView 自动滚动相册


假如你用UIScrollView制作了一个横向的相册,并且每页显示一张图,有点想很多网站首页的广告

//广告定时任务
[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(scrollTimer) userInfo:nil repeats:YES];


//设置滚动
-(void)scrollTimer{    
    timerCount++;
    if (timerCount >= 4) {
        timerCount=0;
    }
    [adView setContentOffset:CGPointMake(tableWidth * timerCount, 0)animated:YES];
    [pageControl setCurrentPage:timerCount];
}

猜你喜欢

转载自zheyiw.iteye.com/blog/1682735