iOS 引導頁圖片自動翻頁滾動

定義屬性 – 定時器

@property (nonatomic ,strong) NSTimer *timer;   // 定時器
//設置定時器
    self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(change:) userInfo:nil repeats:YES];

//定時器執行方法
- (void)change:(NSTimer *)time{
    // 設置滾動視圖的偏移量,self.page.currentPage是設置當前的 page 頁數
    [self.yyScrollView setContentOffset:CGPointMake((self.page.currentPage + 1) * self.view.frame.size.width, 0) animated:NO];
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章