Skip to content

Commit a02664e

Browse files
committed
Added middleCell control/center index bug/skipEnd,rollingBack roving loop bug
1 parent e2d54af commit a02664e

25 files changed

+496
-62
lines changed

Example/JXBanner.xcodeproj/project.pbxproj

Lines changed: 80 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
3838
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
3939
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
40+
6E06070B24174BBC00260BD9 /* mp4_0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6E06070624174BBC00260BD9 /* mp4_0.jpg */; };
41+
6E06070C24174BBC00260BD9 /* mp4_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6E06070724174BBC00260BD9 /* mp4_2.jpg */; };
42+
6E06070D24174BBC00260BD9 /* mp4_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6E06070824174BBC00260BD9 /* mp4_3.jpg */; };
43+
6E06070E24174BBC00260BD9 /* mp4_4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6E06070924174BBC00260BD9 /* mp4_4.jpg */; };
44+
6E06070F24174BBC00260BD9 /* mp4_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6E06070A24174BBC00260BD9 /* mp4_1.jpg */; };
45+
6E07819923D5B13100FE8C60 /* JXMiddleTargetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E07819823D5B13100FE8C60 /* JXMiddleTargetVC.swift */; };
46+
6E07819E23D5B17300FE8C60 /* JXMiddleTargetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E07819C23D5B17300FE8C60 /* JXMiddleTargetCell.swift */; };
47+
6E07819F23D5B17300FE8C60 /* JXMiddleTargetCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E07819D23D5B17300FE8C60 /* JXMiddleTargetCell.xib */; };
4048
/* End PBXBuildFile section */
4149

4250
/* Begin PBXContainerItemProxy section */
@@ -85,6 +93,14 @@
8593
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8694
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
8795
69253EFB2BEA3E4346A791AE /* Pods_JXBanner_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JXBanner_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
96+
6E06070624174BBC00260BD9 /* mp4_0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mp4_0.jpg; sourceTree = "<group>"; };
97+
6E06070724174BBC00260BD9 /* mp4_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mp4_2.jpg; sourceTree = "<group>"; };
98+
6E06070824174BBC00260BD9 /* mp4_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mp4_3.jpg; sourceTree = "<group>"; };
99+
6E06070924174BBC00260BD9 /* mp4_4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mp4_4.jpg; sourceTree = "<group>"; };
100+
6E06070A24174BBC00260BD9 /* mp4_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mp4_1.jpg; sourceTree = "<group>"; };
101+
6E07819823D5B13100FE8C60 /* JXMiddleTargetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JXMiddleTargetVC.swift; sourceTree = "<group>"; };
102+
6E07819C23D5B17300FE8C60 /* JXMiddleTargetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JXMiddleTargetCell.swift; sourceTree = "<group>"; };
103+
6E07819D23D5B17300FE8C60 /* JXMiddleTargetCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = JXMiddleTargetCell.xib; sourceTree = "<group>"; };
88104
86DD0217E9DE21DAB1A6418E /* JXBanner.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = JXBanner.podspec; path = ../JXBanner.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
89105
A8BAC75A289C5E5883552C0B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
90106
B37FA8DFCA403B9BCA5A97D5 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
@@ -110,20 +126,6 @@
110126
/* End PBXFrameworksBuildPhase section */
111127

112128
/* Begin PBXGroup section */
113-
1F30F28E22F02272007ABBED /* Demo */ = {
114-
isa = PBXGroup;
115-
children = (
116-
1F30F29122F022BA007ABBED /* JXDefaultVC.swift */,
117-
1F30F29322F022D3007ABBED /* JXCustomVC.swift */,
118-
1FEE2D0422F5DE170002BAE5 /* JXCycleWayVC.swift */,
119-
1F35B049237FD88100076E3A /* JXScrollViewVC.swift */,
120-
1F35B04B237FDAD100076E3A /* JXScrollViewCell.swift */,
121-
1F35B04C237FDAD100076E3A /* JXScrollViewCell.xib */,
122-
1FEE2D0622F5E0E00002BAE5 /* JXTransformCustomVC */,
123-
);
124-
name = Demo;
125-
sourceTree = "<group>";
126-
};
127129
1F41C6242331D36A00B83DC4 /* source */ = {
128130
isa = PBXGroup;
129131
children = (
@@ -147,15 +149,6 @@
147149
path = source;
148150
sourceTree = "<group>";
149151
};
150-
1FEE2D0622F5E0E00002BAE5 /* JXTransformCustomVC */ = {
151-
isa = PBXGroup;
152-
children = (
153-
1FD96C4822F03806003972F1 /* JXTransformCustomVC.swift */,
154-
1F30F28C22EFEF2A007ABBED /* JXCustomTransform.swift */,
155-
);
156-
name = JXTransformCustomVC;
157-
sourceTree = "<group>";
158-
};
159152
4FC073646F1C0DF9E1D9E731 /* Frameworks */ = {
160153
isa = PBXGroup;
161154
children = (
@@ -197,8 +190,9 @@
197190
607FACD21AFB9204008FA782 /* Example for JXBanner */ = {
198191
isa = PBXGroup;
199192
children = (
193+
6E0606FB241747AC00260BD9 /* mp4 */,
200194
1F41C6242331D36A00B83DC4 /* source */,
201-
1F30F28E22F02272007ABBED /* Demo */,
195+
6E07819523D5AF9D00FE8C60 /* Demo */,
202196
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
203197
607FACDC1AFB9204008FA782 /* Images.xcassets */,
204198
1FAA5AF222A26CA400CC3696 /* Main.storyboard */,
@@ -244,6 +238,60 @@
244238
name = "Podspec Metadata";
245239
sourceTree = "<group>";
246240
};
241+
6E0606FB241747AC00260BD9 /* mp4 */ = {
242+
isa = PBXGroup;
243+
children = (
244+
6E06070624174BBC00260BD9 /* mp4_0.jpg */,
245+
6E06070A24174BBC00260BD9 /* mp4_1.jpg */,
246+
6E06070724174BBC00260BD9 /* mp4_2.jpg */,
247+
6E06070824174BBC00260BD9 /* mp4_3.jpg */,
248+
6E06070924174BBC00260BD9 /* mp4_4.jpg */,
249+
);
250+
path = mp4;
251+
sourceTree = "<group>";
252+
};
253+
6E07819423D5AF7C00FE8C60 /* JXScrollViewVC */ = {
254+
isa = PBXGroup;
255+
children = (
256+
1F35B049237FD88100076E3A /* JXScrollViewVC.swift */,
257+
1F35B04B237FDAD100076E3A /* JXScrollViewCell.swift */,
258+
1F35B04C237FDAD100076E3A /* JXScrollViewCell.xib */,
259+
);
260+
path = JXScrollViewVC;
261+
sourceTree = "<group>";
262+
};
263+
6E07819523D5AF9D00FE8C60 /* Demo */ = {
264+
isa = PBXGroup;
265+
children = (
266+
1F30F29122F022BA007ABBED /* JXDefaultVC.swift */,
267+
1F30F29322F022D3007ABBED /* JXCustomVC.swift */,
268+
1FEE2D0422F5DE170002BAE5 /* JXCycleWayVC.swift */,
269+
6E07819423D5AF7C00FE8C60 /* JXScrollViewVC */,
270+
6E07819623D5AFDA00FE8C60 /* JXTransformCustomVC */,
271+
6E07819723D5AFFA00FE8C60 /* JXMiddleTargetVC */,
272+
);
273+
path = Demo;
274+
sourceTree = "<group>";
275+
};
276+
6E07819623D5AFDA00FE8C60 /* JXTransformCustomVC */ = {
277+
isa = PBXGroup;
278+
children = (
279+
1FD96C4822F03806003972F1 /* JXTransformCustomVC.swift */,
280+
1F30F28C22EFEF2A007ABBED /* JXCustomTransform.swift */,
281+
);
282+
path = JXTransformCustomVC;
283+
sourceTree = "<group>";
284+
};
285+
6E07819723D5AFFA00FE8C60 /* JXMiddleTargetVC */ = {
286+
isa = PBXGroup;
287+
children = (
288+
6E07819823D5B13100FE8C60 /* JXMiddleTargetVC.swift */,
289+
6E07819C23D5B17300FE8C60 /* JXMiddleTargetCell.swift */,
290+
6E07819D23D5B17300FE8C60 /* JXMiddleTargetCell.xib */,
291+
);
292+
path = JXMiddleTargetVC;
293+
sourceTree = "<group>";
294+
};
247295
/* End PBXGroup section */
248296

249297
/* Begin PBXNativeTarget section */
@@ -334,12 +382,17 @@
334382
files = (
335383
1F41C64A2331D9AD00B83DC4 /* 5.jpg in Resources */,
336384
1F41C6442331D9AD00B83DC4 /* 10.jpg in Resources */,
385+
6E06070B24174BBC00260BD9 /* mp4_0.jpg in Resources */,
337386
1F41C64D2331D9AD00B83DC4 /* 2.jpg in Resources */,
387+
6E06070C24174BBC00260BD9 /* mp4_2.jpg in Resources */,
338388
1F41C6522331D9AD00B83DC4 /* 6.jpg in Resources */,
339389
1F41C6452331D9AD00B83DC4 /* 13.jpg in Resources */,
390+
6E07819F23D5B17300FE8C60 /* JXMiddleTargetCell.xib in Resources */,
340391
1F41C64B2331D9AD00B83DC4 /* 11.jpg in Resources */,
392+
6E06070F24174BBC00260BD9 /* mp4_1.jpg in Resources */,
341393
1F41C6482331D9AD00B83DC4 /* 12.jpg in Resources */,
342394
1F41C6492331D9AD00B83DC4 /* 9.jpg in Resources */,
395+
6E06070E24174BBC00260BD9 /* mp4_4.jpg in Resources */,
343396
1F41C6432331D9AD00B83DC4 /* 0.jpg in Resources */,
344397
1FAA5AF322A26CA400CC3696 /* Main.storyboard in Resources */,
345398
1F41C64E2331D9AD00B83DC4 /* 1.jpg in Resources */,
@@ -349,6 +402,7 @@
349402
1F41C6472331D9AD00B83DC4 /* 8.jpg in Resources */,
350403
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
351404
1F41C6462331D9AD00B83DC4 /* 3.jpg in Resources */,
405+
6E06070D24174BBC00260BD9 /* mp4_3.jpg in Resources */,
352406
1F41C6512331D9AD00B83DC4 /* 7.jpg in Resources */,
353407
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
354408
1F41C64C2331D9AD00B83DC4 /* 4.jpg in Resources */,
@@ -424,10 +478,12 @@
424478
1F30F29222F022BA007ABBED /* JXDefaultVC.swift in Sources */,
425479
1FEE2D0522F5DE170002BAE5 /* JXCycleWayVC.swift in Sources */,
426480
1F30F28D22EFEF2A007ABBED /* JXCustomTransform.swift in Sources */,
481+
6E07819E23D5B17300FE8C60 /* JXMiddleTargetCell.swift in Sources */,
427482
1F30F29422F022D3007ABBED /* JXCustomVC.swift in Sources */,
428483
1F35B04D237FDAD100076E3A /* JXScrollViewCell.swift in Sources */,
429484
1F35B04A237FD88100076E3A /* JXScrollViewVC.swift in Sources */,
430485
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
486+
6E07819923D5B13100FE8C60 /* JXMiddleTargetVC.swift in Sources */,
431487
);
432488
runOnlyForDeploymentPostprocessing = 0;
433489
};

Example/JXBanner/JXCustomVC.swift renamed to Example/JXBanner/Demo/JXCustomVC.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,17 @@ extension JXCustomVC: JXBannerDataSource {
124124
return params
125125
.timeInterval(2)
126126
.cycleWay(.forward)
127+
.isAutoPlay(true)
128+
}else if banner.indentify == "converflowBanner" {
129+
return params
130+
.timeInterval(3)
131+
.cycleWay(.forward)
132+
.isAutoPlay(true)
127133
}else {
128134
return params
129135
.timeInterval(3)
130136
.cycleWay(.forward)
137+
.isAutoPlay(true)
131138
}
132139
}
133140

@@ -226,7 +233,7 @@ extension JXCustomVC: JXBannerDelegate {
226233
}
227234

228235
func jxBanner(_ banner: JXBannerType, center index: Int) {
229-
// print(index)
236+
print(index)
230237
}
231238

232239

Example/JXBanner/JXCycleWayVC.swift renamed to Example/JXBanner/Demo/JXCycleWayVC.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ extension JXCycleWayVC: JXBannerDataSource {
9898

9999
if banner.indentify == "linearBanner" {
100100
return params
101-
.timeInterval(2)
101+
.timeInterval(5)
102102
.cycleWay(.rollingBack)
103103
}else {
104104
return params
105-
.timeInterval(3)
105+
.timeInterval(10)
106106
.cycleWay(.skipEnd)
107107
}
108108
}
@@ -180,6 +180,10 @@ extension JXCycleWayVC: JXBannerDelegate {
180180
didSelectItemAt index: Int) {
181181
print(index)
182182
}
183+
184+
func jxBanner(_ banner: JXBannerType, center index: Int) {
185+
print(index)
186+
}
183187
}
184188

185189

Example/JXBanner/JXDefaultVC.swift renamed to Example/JXBanner/Demo/JXDefaultVC.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class JXDefaultVC: UIViewController {
2828
deinit {
2929
print("\(#function) ----------> \(#file.components(separatedBy: "/").last?.components(separatedBy: ".").first ?? #file)")
3030
}
31+
32+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
33+
banner.reloadView()
34+
}
3135
}
3236

3337
//MARK:- JXBannerDataSource
@@ -61,6 +65,7 @@ extension JXDefaultVC: JXBannerDataSource {
6165
.itemSize(CGSize(width: 300, height: 150))
6266
.itemSpacing(20)
6367
}
68+
6469
}
6570

6671
//MARK:- JXBannerDelegate
@@ -71,4 +76,10 @@ extension JXDefaultVC: JXBannerDelegate {
7176
print(index)
7277
}
7378

79+
func jxBanner(_ banner: JXBannerType, center index: Int) {
80+
print(index)
81+
}
82+
83+
84+
7485
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// JXMiddleTargetCell.swift
3+
// JXBanner_Example
4+
//
5+
// Created by tjx on 2020/1/20.
6+
// Copyright © 2020 CocoaPods. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import AVKit
11+
12+
class JXMiddleTargetCell: UICollectionViewCell {
13+
14+
@IBOutlet weak var bgView: UIView!
15+
@IBOutlet weak var imageView: UIImageView!
16+
17+
18+
var player : AVPlayer!
19+
var palyerItem : AVPlayerItem!
20+
var bufferTimeLabel : UILabel!
21+
var playerLayer: AVPlayerLayer?
22+
23+
override func awakeFromNib() {
24+
super.awakeFromNib()
25+
}
26+
27+
func play(_ urlStr: String) {
28+
29+
guard let url = NSURL(string: urlStr) as URL? else {
30+
return
31+
}
32+
33+
self.palyerItem = AVPlayerItem(url: url)
34+
//创建ACplayer:负责视频播放
35+
self.player = AVPlayer.init(playerItem: self.palyerItem)
36+
self.player.rate = 1.0//播放速度 播放前设置
37+
//创建显示视频的图层
38+
playerLayer = AVPlayerLayer.init(player: self.player)
39+
playerLayer?.videoGravity = .resizeAspect
40+
playerLayer?.frame = self.bgView.bounds
41+
playerLayer?.backgroundColor = UIColor.black.cgColor
42+
self.imageView.layer.addSublayer(playerLayer!)
43+
//播放
44+
self.player.play()
45+
}
46+
47+
func stop() {
48+
self.player.pause()
49+
playerLayer?.removeFromSuperlayer()
50+
}
51+
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<objects>
11+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
12+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13+
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="JXMiddleTargetCell" customModule="JXBanner_Example" customModuleProvider="target">
14+
<rect key="frame" x="0.0" y="0.0" width="368" height="182"/>
15+
<autoresizingMask key="autoresizingMask"/>
16+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
17+
<rect key="frame" x="0.0" y="0.0" width="368" height="182"/>
18+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
19+
<subviews>
20+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fH0-WS-eQi">
21+
<rect key="frame" x="0.0" y="0.0" width="368" height="182"/>
22+
<subviews>
23+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="b9Y-q8-WHt">
24+
<rect key="frame" x="0.0" y="0.0" width="368" height="182"/>
25+
</imageView>
26+
</subviews>
27+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
28+
<constraints>
29+
<constraint firstAttribute="bottom" secondItem="b9Y-q8-WHt" secondAttribute="bottom" id="2Nh-8s-hvJ"/>
30+
<constraint firstItem="b9Y-q8-WHt" firstAttribute="top" secondItem="fH0-WS-eQi" secondAttribute="top" id="840-rU-hiu"/>
31+
<constraint firstItem="b9Y-q8-WHt" firstAttribute="leading" secondItem="fH0-WS-eQi" secondAttribute="leading" id="eB9-me-Dew"/>
32+
<constraint firstAttribute="trailing" secondItem="b9Y-q8-WHt" secondAttribute="trailing" id="jqz-Ym-wNc"/>
33+
</constraints>
34+
</view>
35+
</subviews>
36+
</view>
37+
<constraints>
38+
<constraint firstItem="fH0-WS-eQi" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="DVX-HQ-mjU"/>
39+
<constraint firstItem="fH0-WS-eQi" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="KoV-0N-8Ds"/>
40+
<constraint firstAttribute="trailing" secondItem="fH0-WS-eQi" secondAttribute="trailing" id="TVp-cn-CJz"/>
41+
<constraint firstAttribute="bottom" secondItem="fH0-WS-eQi" secondAttribute="bottom" id="WWH-bg-2vH"/>
42+
</constraints>
43+
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
44+
<size key="customSize" width="368" height="182"/>
45+
<connections>
46+
<outlet property="bgView" destination="fH0-WS-eQi" id="S1U-di-4hN"/>
47+
<outlet property="imageView" destination="b9Y-q8-WHt" id="Dx7-lq-4EE"/>
48+
</connections>
49+
<point key="canvasLocation" x="128.98550724637681" y="157.36607142857142"/>
50+
</collectionViewCell>
51+
</objects>
52+
</document>

0 commit comments

Comments
 (0)