Commit c5300261e59b6b8496edb2e9fa5bc56f0caecacf
1 parent
6787d3fe
修复横屏选集时能控制播放器的问题
Showing
4 changed files
with
187 additions
and
5 deletions
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeBeiSuView.swift
| ... | ... | @@ -9,7 +9,7 @@ import Foundation |
| 9 | 9 | |
| 10 | 10 | typealias CNLiveVodLandscapeBeiSuUpdateBlock = (_ rate:Float)->Void |
| 11 | 11 | |
| 12 | -class CNLiveVodLandscapeBeiSuView:UIView{ | |
| 12 | +class CNLiveVodLandscapeBeiSuView:UIView,UIGestureRecognizerDelegate{ | |
| 13 | 13 | |
| 14 | 14 | var beiSuUpdateBlock:CNLiveVodLandscapeBeiSuUpdateBlock? |
| 15 | 15 | var currSeleIdx = 2//1.0 |
| ... | ... | @@ -87,6 +87,66 @@ class CNLiveVodLandscapeBeiSuView:UIView{ |
| 87 | 87 | expandBtn.addTarget(self, action: #selector(beisuBtnAction), for: .touchUpInside) |
| 88 | 88 | self.addSubview(expandBtn) |
| 89 | 89 | } |
| 90 | + | |
| 91 | + self.initGesture() | |
| 92 | + } | |
| 93 | + | |
| 94 | + func initGesture(){ | |
| 95 | + self.isMultipleTouchEnabled = true | |
| 96 | + | |
| 97 | + // 双击手势 | |
| 98 | + var doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(doubleTapAction)) | |
| 99 | + doubleTapGesture.numberOfTapsRequired = 2 // 双击触发 | |
| 100 | + doubleTapGesture.delaysTouchesBegan = true | |
| 101 | + doubleTapGesture.delaysTouchesEnded = true | |
| 102 | + doubleTapGesture.numberOfTouchesRequired = 1 | |
| 103 | + | |
| 104 | + var panGesture = UIPanGestureRecognizer(target: self, action: #selector(panAction)) | |
| 105 | + panGesture.delaysTouchesBegan = true | |
| 106 | + panGesture.delaysTouchesEnded = true | |
| 107 | + panGesture.maximumNumberOfTouches = 1 | |
| 108 | + panGesture.cancelsTouchesInView = true | |
| 109 | + | |
| 110 | + var tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapAction)) | |
| 111 | + tapGesture.delaysTouchesBegan = true | |
| 112 | + tapGesture.delaysTouchesEnded = true | |
| 113 | + tapGesture.numberOfTouchesRequired = 1 | |
| 114 | + tapGesture.numberOfTapsRequired = 1 | |
| 115 | + tapGesture.require(toFail: doubleTapGesture) | |
| 116 | + tapGesture.require(toFail: panGesture) | |
| 117 | + self.addGestureRecognizer(tapGesture) | |
| 118 | + self.addGestureRecognizer(doubleTapGesture) | |
| 119 | + self.addGestureRecognizer(panGesture) | |
| 120 | + | |
| 121 | + var pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(pinchAction)) | |
| 122 | + pinchGesture.delaysTouchesBegan = true | |
| 123 | + self.addGestureRecognizer(pinchGesture) | |
| 124 | + | |
| 125 | + // 长按手势 | |
| 126 | + var longGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressAction)) | |
| 127 | + longGesture.minimumPressDuration = 0.5// 长按触发时间(秒) | |
| 128 | + self.addGestureRecognizer(longGesture) | |
| 129 | + } | |
| 130 | +// @objc func tapAction(){ | |
| 131 | +//// self.isHidden = true | |
| 132 | +// print("tapAction") | |
| 133 | +// } | |
| 134 | + @objc func pinchAction(){ | |
| 135 | +// self.isHidden = true | |
| 136 | + print("pinchAction") | |
| 137 | + } | |
| 138 | + @objc func longPressAction(){ | |
| 139 | +// self.isHidden = true | |
| 140 | + print("longPressAction") | |
| 141 | + } | |
| 142 | + @objc func doubleTapAction(){ | |
| 143 | +// self.isHidden = true | |
| 144 | + print("doubleTapAction") | |
| 145 | + } | |
| 146 | + | |
| 147 | + @objc func panAction(){ | |
| 148 | +// self.isHidden = true | |
| 149 | + print("panAction") | |
| 90 | 150 | } |
| 91 | 151 | |
| 92 | 152 | @objc func beisuBtnAction(btn:UIButton){ | ... | ... |
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeGaoqingView.swift
| ... | ... | @@ -10,7 +10,7 @@ import Foundation |
| 10 | 10 | //标清 2 ,高清 3 ,超清 4 |
| 11 | 11 | typealias CNLiveVodLandscapeGaoqingUpdateBlock = (_ gaoqing:Int)->Void |
| 12 | 12 | |
| 13 | -class CNLiveVodLandscapeGaoqingView:UIView{ | |
| 13 | +class CNLiveVodLandscapeGaoqingView:UIView,UIGestureRecognizerDelegate{ | |
| 14 | 14 | |
| 15 | 15 | var gaoqingUpdateBlock:CNLiveVodLandscapeGaoqingUpdateBlock? |
| 16 | 16 | var currSeleIdx = 1//720 |
| ... | ... | @@ -29,6 +29,66 @@ class CNLiveVodLandscapeGaoqingView:UIView{ |
| 29 | 29 | self.isUserInteractionEnabled = true |
| 30 | 30 | self.initUI() |
| 31 | 31 | self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapAction))) |
| 32 | + | |
| 33 | + self.initGesture() | |
| 34 | + } | |
| 35 | + | |
| 36 | + func initGesture(){ | |
| 37 | + self.isMultipleTouchEnabled = true | |
| 38 | + | |
| 39 | + // 双击手势 | |
| 40 | + var doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(doubleTapAction)) | |
| 41 | + doubleTapGesture.numberOfTapsRequired = 2 // 双击触发 | |
| 42 | + doubleTapGesture.delaysTouchesBegan = true | |
| 43 | + doubleTapGesture.delaysTouchesEnded = true | |
| 44 | + doubleTapGesture.numberOfTouchesRequired = 1 | |
| 45 | + | |
| 46 | + var panGesture = UIPanGestureRecognizer(target: self, action: #selector(panAction)) | |
| 47 | + panGesture.delaysTouchesBegan = true | |
| 48 | + panGesture.delaysTouchesEnded = true | |
| 49 | + panGesture.maximumNumberOfTouches = 1 | |
| 50 | + panGesture.cancelsTouchesInView = true | |
| 51 | + | |
| 52 | + var tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapAction)) | |
| 53 | + tapGesture.delaysTouchesBegan = true | |
| 54 | + tapGesture.delaysTouchesEnded = true | |
| 55 | + tapGesture.numberOfTouchesRequired = 1 | |
| 56 | + tapGesture.numberOfTapsRequired = 1 | |
| 57 | + tapGesture.require(toFail: doubleTapGesture) | |
| 58 | + tapGesture.require(toFail: panGesture) | |
| 59 | + self.addGestureRecognizer(tapGesture) | |
| 60 | + self.addGestureRecognizer(doubleTapGesture) | |
| 61 | + self.addGestureRecognizer(panGesture) | |
| 62 | + | |
| 63 | + var pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(pinchAction)) | |
| 64 | + pinchGesture.delaysTouchesBegan = true | |
| 65 | + self.addGestureRecognizer(pinchGesture) | |
| 66 | + | |
| 67 | + // 长按手势 | |
| 68 | + var longGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressAction)) | |
| 69 | + longGesture.minimumPressDuration = 0.5// 长按触发时间(秒) | |
| 70 | + self.addGestureRecognizer(longGesture) | |
| 71 | + } | |
| 72 | +// @objc func tapAction(){ | |
| 73 | +//// self.isHidden = true | |
| 74 | +// print("tapAction") | |
| 75 | +// } | |
| 76 | + @objc func pinchAction(){ | |
| 77 | +// self.isHidden = true | |
| 78 | + print("pinchAction") | |
| 79 | + } | |
| 80 | + @objc func longPressAction(){ | |
| 81 | +// self.isHidden = true | |
| 82 | + print("longPressAction") | |
| 83 | + } | |
| 84 | + @objc func doubleTapAction(){ | |
| 85 | +// self.isHidden = true | |
| 86 | + print("doubleTapAction") | |
| 87 | + } | |
| 88 | + | |
| 89 | + @objc func panAction(){ | |
| 90 | +// self.isHidden = true | |
| 91 | + print("panAction") | |
| 32 | 92 | } |
| 33 | 93 | |
| 34 | 94 | required init?(coder: NSCoder) { | ... | ... |
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeXuanjiView.swift
| ... | ... | @@ -13,7 +13,7 @@ typealias CNLiveVodPlayerLandscapeXuanjiUpdateBlock = (_ jishuIndex:Int,_ albumM |
| 13 | 13 | //看点选择某一集 |
| 14 | 14 | typealias CNLiveVodPlayerLandscapeXuanjiKanDianSelectBlock = (_ kanDianIndex:Int,_ vodPlayBlockListListModel:CNLiveVodPlayBlockListListModel)->Void |
| 15 | 15 | |
| 16 | -class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDelegate{//, UICollectionViewDelegate, UICollectionViewDataSource{ | |
| 16 | +class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDelegate,UIGestureRecognizerDelegate{//, UICollectionViewDelegate, UICollectionViewDataSource{ | |
| 17 | 17 | |
| 18 | 18 | var currSeleIdx = 0 |
| 19 | 19 | // var selectBlock:CNLiveVodAlbumListCellSelectBlock? |
| ... | ... | @@ -155,8 +155,65 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel |
| 155 | 155 | make.bottom.equalToSuperview().offset(-50) |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - | |
| 158 | + self.initGesture() | |
| 159 | + } | |
| 160 | + | |
| 161 | + func initGesture(){ | |
| 162 | + self.isMultipleTouchEnabled = true | |
| 163 | + | |
| 164 | + // 双击手势 | |
| 165 | + var doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(doubleTapAction)) | |
| 166 | + doubleTapGesture.numberOfTapsRequired = 2 // 双击触发 | |
| 167 | + doubleTapGesture.delaysTouchesBegan = true | |
| 168 | + doubleTapGesture.delaysTouchesEnded = true | |
| 169 | + doubleTapGesture.numberOfTouchesRequired = 1 | |
| 170 | + | |
| 171 | + var panGesture = UIPanGestureRecognizer(target: self, action: #selector(panAction)) | |
| 172 | + panGesture.delaysTouchesBegan = true | |
| 173 | + panGesture.delaysTouchesEnded = true | |
| 174 | + panGesture.maximumNumberOfTouches = 1 | |
| 175 | + panGesture.cancelsTouchesInView = true | |
| 176 | + | |
| 177 | + var tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapAction)) | |
| 178 | + tapGesture.delaysTouchesBegan = true | |
| 179 | + tapGesture.delaysTouchesEnded = true | |
| 180 | + tapGesture.numberOfTouchesRequired = 1 | |
| 181 | + tapGesture.numberOfTapsRequired = 1 | |
| 182 | + tapGesture.require(toFail: doubleTapGesture) | |
| 183 | + tapGesture.require(toFail: panGesture) | |
| 184 | + self.addGestureRecognizer(tapGesture) | |
| 185 | + self.addGestureRecognizer(doubleTapGesture) | |
| 186 | + self.addGestureRecognizer(panGesture) | |
| 187 | + | |
| 188 | + var pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(pinchAction)) | |
| 189 | + pinchGesture.delaysTouchesBegan = true | |
| 190 | + self.addGestureRecognizer(pinchGesture) | |
| 159 | 191 | |
| 192 | + // 长按手势 | |
| 193 | + var longGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressAction)) | |
| 194 | + longGesture.minimumPressDuration = 0.5// 长按触发时间(秒) | |
| 195 | + self.addGestureRecognizer(longGesture) | |
| 196 | + } | |
| 197 | +// @objc func tapAction(){ | |
| 198 | +//// self.isHidden = true | |
| 199 | +// print("tapAction") | |
| 200 | +// } | |
| 201 | + @objc func pinchAction(){ | |
| 202 | +// self.isHidden = true | |
| 203 | + print("pinchAction") | |
| 204 | + } | |
| 205 | + @objc func longPressAction(){ | |
| 206 | +// self.isHidden = true | |
| 207 | + print("longPressAction") | |
| 208 | + } | |
| 209 | + @objc func doubleTapAction(){ | |
| 210 | +// self.isHidden = true | |
| 211 | + print("doubleTapAction") | |
| 212 | + } | |
| 213 | + | |
| 214 | + @objc func panAction(){ | |
| 215 | +// self.isHidden = true | |
| 216 | + print("panAction") | |
| 160 | 217 | } |
| 161 | 218 | |
| 162 | 219 | //看点列表 | ... | ... |
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodPayView.swift
| ... | ... | @@ -46,6 +46,11 @@ class CNLiveVodPayView:UIView,UIGestureRecognizerDelegate{ |
| 46 | 46 | self.backgroundColor = HexColor("#000000", alpha: 0.7) |
| 47 | 47 | self.isUserInteractionEnabled = true |
| 48 | 48 | self.initUI() |
| 49 | + | |
| 50 | + self.initGesture() | |
| 51 | + } | |
| 52 | + | |
| 53 | + func initGesture(){ | |
| 49 | 54 | self.isMultipleTouchEnabled = true |
| 50 | 55 | |
| 51 | 56 | // 双击手势 |
| ... | ... | @@ -81,7 +86,7 @@ class CNLiveVodPayView:UIView,UIGestureRecognizerDelegate{ |
| 81 | 86 | longGesture.minimumPressDuration = 0.5// 长按触发时间(秒) |
| 82 | 87 | self.addGestureRecognizer(longGesture) |
| 83 | 88 | } |
| 84 | - | |
| 89 | + | |
| 85 | 90 | required init?(coder: NSCoder) { |
| 86 | 91 | fatalError("init(coder:) has not been implemented") |
| 87 | 92 | } | ... | ... |