//創(chuàng)建與設(shè)置
UIScrollView *merchantHeaderMenuScrollView = [[UIScrollView alloc]init];
//注意?偻!赶么!就是在tableView里库继,加入滾動(dòng)框膏孟,要監(jiān)聽該滾動(dòng)框的滾動(dòng)葬燎,一定要寫代理賦值!缚甩!
merchantHeaderMenuScrollView.delegate = self;
merchantHeaderMenuScrollView.backgroundColor = [UIColor whiteColor];
[self.merchantHeaderView addSubview:merchantHeaderMenuScrollView];
self.merchantHeaderMenuScrollView = merchantHeaderMenuScrollView;
UIPageControl *merchantHeaderMenuPageControl = [[UIPageControl alloc]init];
// 設(shè)置UIPageControl的圓點(diǎn)的顏色
merchantHeaderMenuPageControl.pageIndicatorTintColor = UIColorFromRGBA(200, 200, 200, 0.6);
// 設(shè)置UIPageControl的高亮圓點(diǎn)的顏色
merchantHeaderMenuPageControl.currentPageIndicatorTintColor = kMainColorOfApp;
//設(shè)置UIPageControl不容許用戶交互
merchantHeaderMenuPageControl.userInteractionEnabled = NO;
[self.merchantHeaderView addSubview:merchantHeaderMenuPageControl];
merchantHeaderMenuPageControl.backgroundColor = [UIColor whiteColor];
//設(shè)置frame
self.merchantHeaderMenuPageControl.frame = CGRectMake(0, CGRectGetMaxY(self.merchantHeaderMenuScrollView.frame),self.merchantHeaderView.width,37);
//監(jiān)聽滾動(dòng)框滾動(dòng)
#pragma mark - scrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (![scrollView isKindOfClass:[self.tableView class]]) {
self.merchantHeaderMenuPageControl.currentPage = (int)self.merchantHeaderMenuScrollView.contentOffset.x / self.merchantHeaderMenuScrollView.width;
}
}