Showing
5 changed files
with
37 additions
and
4 deletions
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
... | @@ -14,6 +14,7 @@ import UIKit | ... | @@ -14,6 +14,7 @@ import UIKit |
14 | @IBOutlet weak var tagLabel2: UILabel! | 14 | @IBOutlet weak var tagLabel2: UILabel! |
15 | @IBOutlet weak var profileImage: UIImageView! | 15 | @IBOutlet weak var profileImage: UIImageView! |
16 | @IBOutlet weak var collectionView: UICollectionView! | 16 | @IBOutlet weak var collectionView: UICollectionView! |
17 | + @IBOutlet weak var pageControl: UIPageControl! | ||
17 | 18 | ||
18 | var data: SectionModel? | 19 | var data: SectionModel? |
19 | 20 | ||
... | @@ -65,6 +66,12 @@ import UIKit | ... | @@ -65,6 +66,12 @@ import UIKit |
65 | // Set delegates | 66 | // Set delegates |
66 | collectionView.delegate = self | 67 | collectionView.delegate = self |
67 | collectionView.dataSource = self | 68 | collectionView.dataSource = self |
69 | + | ||
70 | + // Configure page control | ||
71 | + pageControl.currentPageIndicatorTintColor = UIColor(rgb: 0xEE437E) | ||
72 | + pageControl.pageIndicatorTintColor = UIColor(rgb: 0xD8D8D8) | ||
73 | + pageControl.hidesForSinglePage = true | ||
74 | + pageControl.isUserInteractionEnabled = false // Disable direct tapping on page control | ||
68 | } | 75 | } |
69 | 76 | ||
70 | public override func setSelected(_ selected: Bool, animated: Bool) { | 77 | public override func setSelected(_ selected: Bool, animated: Bool) { |
... | @@ -75,6 +82,12 @@ import UIKit | ... | @@ -75,6 +82,12 @@ import UIKit |
75 | 82 | ||
76 | func configureCell(data: SectionModel?) { | 83 | func configureCell(data: SectionModel?) { |
77 | self.data = data | 84 | self.data = data |
85 | + | ||
86 | + // Configure page control | ||
87 | + let numberOfPages = self.data?.offers.count ?? 0 | ||
88 | + pageControl.numberOfPages = numberOfPages | ||
89 | + pageControl.currentPage = 0 | ||
90 | + | ||
78 | self.collectionView.reloadData(); | 91 | self.collectionView.reloadData(); |
79 | } | 92 | } |
80 | } | 93 | } |
... | @@ -122,4 +135,17 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, | ... | @@ -122,4 +135,17 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, |
122 | public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { | 135 | public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { |
123 | return UIEdgeInsets.zero | 136 | return UIEdgeInsets.zero |
124 | } | 137 | } |
138 | + | ||
139 | + // MARK: - UIScrollViewDelegate | ||
140 | + public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { | ||
141 | + let pageWidth = scrollView.frame.width | ||
142 | + let currentPage = Int(scrollView.contentOffset.x / pageWidth) | ||
143 | + pageControl.currentPage = currentPage | ||
144 | + } | ||
145 | + | ||
146 | + public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { | ||
147 | + let pageWidth = scrollView.frame.width | ||
148 | + let currentPage = Int(scrollView.contentOffset.x / pageWidth) | ||
149 | + pageControl.currentPage = currentPage | ||
150 | + } | ||
125 | } | 151 | } | ... | ... |
... | @@ -111,19 +111,25 @@ | ... | @@ -111,19 +111,25 @@ |
111 | <outlet property="delegate" destination="KGk-i7-Jjw" id="fQ4-0u-38c"/> | 111 | <outlet property="delegate" destination="KGk-i7-Jjw" id="fQ4-0u-38c"/> |
112 | </connections> | 112 | </connections> |
113 | </collectionView> | 113 | </collectionView> |
114 | + <pageControl opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" translatesAutoresizingMaskIntoConstraints="NO" id="lOm-CZ-dVG"> | ||
115 | + <rect key="frame" x="170" y="136" width="73" height="26"/> | ||
116 | + </pageControl> | ||
114 | </subviews> | 117 | </subviews> |
115 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 118 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
116 | <constraints> | 119 | <constraints> |
117 | - <constraint firstAttribute="bottom" secondItem="I7z-Fz-SNP" secondAttribute="bottom" id="0xG-dd-XJl"/> | 120 | + <constraint firstItem="lOm-CZ-dVG" firstAttribute="top" secondItem="I7z-Fz-SNP" secondAttribute="bottom" id="0xG-dd-XJl"/> |
121 | + <constraint firstAttribute="bottom" secondItem="lOm-CZ-dVG" secondAttribute="bottom" id="7gm-Kg-nCS"/> | ||
118 | <constraint firstItem="JTs-J5-DO2" firstAttribute="top" secondItem="VzF-dQ-3Wa" secondAttribute="top" constant="36" id="Ac5-fx-J3w"/> | 122 | <constraint firstItem="JTs-J5-DO2" firstAttribute="top" secondItem="VzF-dQ-3Wa" secondAttribute="top" constant="36" id="Ac5-fx-J3w"/> |
119 | <constraint firstItem="JTs-J5-DO2" firstAttribute="leading" secondItem="VzF-dQ-3Wa" secondAttribute="leading" constant="24" id="B98-id-FLf"/> | 123 | <constraint firstItem="JTs-J5-DO2" firstAttribute="leading" secondItem="VzF-dQ-3Wa" secondAttribute="leading" constant="24" id="B98-id-FLf"/> |
120 | <constraint firstAttribute="trailing" secondItem="JTs-J5-DO2" secondAttribute="trailing" constant="24" id="Rdi-FK-2Ft"/> | 124 | <constraint firstAttribute="trailing" secondItem="JTs-J5-DO2" secondAttribute="trailing" constant="24" id="Rdi-FK-2Ft"/> |
121 | <constraint firstAttribute="trailing" secondItem="I7z-Fz-SNP" secondAttribute="trailing" id="avB-Gc-ttI"/> | 125 | <constraint firstAttribute="trailing" secondItem="I7z-Fz-SNP" secondAttribute="trailing" id="avB-Gc-ttI"/> |
122 | <constraint firstItem="I7z-Fz-SNP" firstAttribute="leading" secondItem="VzF-dQ-3Wa" secondAttribute="leading" id="pTY-7d-s1S"/> | 126 | <constraint firstItem="I7z-Fz-SNP" firstAttribute="leading" secondItem="VzF-dQ-3Wa" secondAttribute="leading" id="pTY-7d-s1S"/> |
123 | - <constraint firstItem="I7z-Fz-SNP" firstAttribute="top" secondItem="JTs-J5-DO2" secondAttribute="bottom" constant="10" id="vJF-jy-p83"/> | 127 | + <constraint firstItem="I7z-Fz-SNP" firstAttribute="top" secondItem="JTs-J5-DO2" secondAttribute="bottom" constant="5" id="vJF-jy-p83"/> |
128 | + <constraint firstItem="lOm-CZ-dVG" firstAttribute="centerX" secondItem="VzF-dQ-3Wa" secondAttribute="centerX" id="xpw-tV-NcW"/> | ||
124 | </constraints> | 129 | </constraints> |
125 | </view> | 130 | </view> |
126 | </subviews> | 131 | </subviews> |
132 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
127 | <constraints> | 133 | <constraints> |
128 | <constraint firstItem="VzF-dQ-3Wa" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="7Ut-VE-YGv"/> | 134 | <constraint firstItem="VzF-dQ-3Wa" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="7Ut-VE-YGv"/> |
129 | <constraint firstAttribute="trailing" secondItem="VzF-dQ-3Wa" secondAttribute="trailing" id="Hic-ok-g96"/> | 135 | <constraint firstAttribute="trailing" secondItem="VzF-dQ-3Wa" secondAttribute="trailing" id="Hic-ok-g96"/> |
... | @@ -135,6 +141,7 @@ | ... | @@ -135,6 +141,7 @@ |
135 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 141 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
136 | <connections> | 142 | <connections> |
137 | <outlet property="collectionView" destination="I7z-Fz-SNP" id="yrF-mR-aQu"/> | 143 | <outlet property="collectionView" destination="I7z-Fz-SNP" id="yrF-mR-aQu"/> |
144 | + <outlet property="pageControl" destination="lOm-CZ-dVG" id="Skf-hV-rjH"/> | ||
138 | <outlet property="profileImage" destination="fZO-NB-UyL" id="l05-qG-DJv"/> | 145 | <outlet property="profileImage" destination="fZO-NB-UyL" id="l05-qG-DJv"/> |
139 | <outlet property="tagLabel1" destination="4m7-JY-MDY" id="Min-YW-AN2"/> | 146 | <outlet property="tagLabel1" destination="4m7-JY-MDY" id="Min-YW-AN2"/> |
140 | <outlet property="tagLabel2" destination="WN9-wM-hV8" id="yWk-1S-4Zk"/> | 147 | <outlet property="tagLabel2" destination="WN9-wM-hV8" id="yWk-1S-4Zk"/> | ... | ... |
-
Please register or login to post a comment