首页 > 代码库 > 循环轮转,

循环轮转,

-(void)scrollByTimer

{

    CGPoint oldoffset = cellScrollView.contentOffset;

    CGPoint newOffset = CGPointMake(cellScrollView.contentOffset.x+320, cellScrollView.contentOffset.y);

    if (oldoffset.x >= 320*(cellData.count-1)) {

        CGPoint beginPoint = CGPointMake(0, cellScrollView.contentOffset.y);

        [cellScrollView setContentOffset:beginPoint animated:YES];

    }else{

        [cellScrollView setContentOffset:newOffset animated:YES];

    }

}

 

-(void)scheduleTimer

{

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(scrollByTimer) userInfo:Nil repeats:YES];

}