| | |
| | | scrollView.contentOffset = CGPoint(x:width,y:0) |
| | | scrollView.isUserInteractionEnabled = true |
| | | scrollView.isPagingEnabled = true |
| | | scrollView.isScrollEnabled = images.count > 1 |
| | | scrollView.showsHorizontalScrollIndicator = false |
| | | scrollView.delegate = self |
| | | self.addSubview(scrollView) |
| | |
| | | scrollView.addSubview(image) |
| | | setImage(image: image, index: 0) |
| | | |
| | | pageControl.center = CGPoint(x:width/2,y:height - CGFloat(15)) |
| | | // pageControl.center = CGPoint(x:width/2,y:height - CGFloat(15)) |
| | | pageControl.isEnabled = true |
| | | pageControl.numberOfPages = images.count |
| | | pageControl.currentPageIndicatorTintColor = UIColor.green |
| | | pageControl.pageIndicatorTintColor = UIColor.gray |
| | | pageControl.currentPageIndicatorTintColor = UIColor.white |
| | | pageControl.pageIndicatorTintColor = UIColor.gray.withAlphaComponent(0.5) |
| | | pageControl.isUserInteractionEnabled = false |
| | | pageControl.isHidden = images.count == 1 |
| | | self.addSubview(pageControl) |
| | | pageControl.snp.makeConstraints { make in |
| | | make.bottom.equalToSuperview().offset(0) |
| | | make.centerX.equalToSuperview() |
| | | } |
| | | |
| | | //当前显示的只有 center_image 其他两个只是⽤来增加滑动时效果⽽已,不 |
| | | //addTapGesWithImage(image: center_image) |