// // FKCircleScrollView.m // FirstLink // // Created by 施昌鹏 on 16/8/17. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKCircleScrollView.h" @interface FKCircleScrollView () @end @implementation FKCircleScrollView -(instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self addAllSubviews]; } return self; } #pragma mark - Layout -(void)addAllSubviews { [self addSubview:self.banerView]; [self addSubview:self.pageControl]; [self.banerView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(UIEdgeInsetsZero); }]; [self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.banerView); make.bottom.equalTo(self.banerView).offset(-8); make.height.mas_equalTo(20); }]; } #pragma mark - DPBannerViewDelegate -(void)bannerView:(DPBannerView *)bannerView didShowAtIndex:(NSInteger)index { self.pageControl.currentPage = index; } #pragma mark - property -(DPBannerView *)banerView { if (_banerView == nil) { _banerView = [[DPBannerView alloc] init]; _banerView.backgroundColor = UIColorFromRGB(0xeeeeee); _banerView.delegate = self; _banerView.scrollView.scrollsToTop = NO; } return _banerView; } -(UIPageControl *)pageControl { if (_pageControl == nil) { _pageControl = [[UIPageControl alloc] init]; _pageControl.currentPage = 0; _pageControl.pageIndicatorTintColor = [UIColor colorWithWhite:1.0 alpha:0.6]; _pageControl.currentPageIndicatorTintColor = [UIColor whiteColor]; } return _pageControl; } @end