Commit 6337a8d40fba3de3d9b4c0f2fd73f649266695bd

Authored by 左丞
1 parent 9fc0a20e
Exists in newLive

no message

YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj
... ... @@ -15,6 +15,7 @@
15 15 5904FC531ECA8BB500E631FF /* MicroCourse.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5904FC521ECA8BB500E631FF /* MicroCourse.storyboard */; };
16 16 5904FC551ECA8BCB00E631FF /* HomePage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5904FC541ECA8BCB00E631FF /* HomePage.storyboard */; };
17 17 5904FC611ECA930D00E631FF /* MViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5904FC601ECA930D00E631FF /* MViewController.swift */; };
  18 + 595071031ED02C140056E078 /* ExcellentTVViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 595071021ED02C140056E078 /* ExcellentTVViewController.swift */; };
18 19 5960263B1DD94D3100C6B5E8 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263A1DD94D3100C6B5E8 /* libsqlite3.tbd */; };
19 20 5960263D1DD94D5E00C6B5E8 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263C1DD94D5E00C6B5E8 /* libc++.tbd */; };
20 21 5960263F1DD94D7D00C6B5E8 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263E1DD94D7D00C6B5E8 /* ImageIO.framework */; };
... ... @@ -49,6 +50,7 @@
49 50 59AE3DF91ECE8A90003E2C62 /* pinyin.c in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DF71ECE8A90003E2C62 /* pinyin.c */; };
50 51 59AE3DFB1ECECD7D003E2C62 /* LiveInforViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFA1ECECD7D003E2C62 /* LiveInforViewController.swift */; };
51 52 59AE3DFD1ECED5B1003E2C62 /* MoivePlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFC1ECED5B1003E2C62 /* MoivePlayerViewController.swift */; };
  53 + 59AE3DFF1ECFDAFD003E2C62 /* TVStationChannelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */; };
52 54 59BA13251E25CF2B00540DE0 /* AliyunPlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */; };
53 55 59BA13271E25CF4B00540DE0 /* AliyunPlayerSDK.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
54 56 59BA13311E25D1C000540DE0 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 59BA13301E25D1C000540DE0 /* Reachability.m */; };
... ... @@ -221,6 +223,7 @@
221 223 5904FC521ECA8BB500E631FF /* MicroCourse.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MicroCourse.storyboard; sourceTree = "<group>"; };
222 224 5904FC541ECA8BCB00E631FF /* HomePage.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = HomePage.storyboard; sourceTree = "<group>"; };
223 225 5904FC601ECA930D00E631FF /* MViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MViewController.swift; sourceTree = "<group>"; };
  226 + 595071021ED02C140056E078 /* ExcellentTVViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExcellentTVViewController.swift; sourceTree = "<group>"; };
224 227 5960263A1DD94D3100C6B5E8 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
225 228 5960263C1DD94D5E00C6B5E8 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
226 229 5960263E1DD94D7D00C6B5E8 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
... ... @@ -335,6 +338,7 @@
335 338 59AE3DF81ECE8A90003E2C62 /* pinyin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pinyin.h; sourceTree = "<group>"; };
336 339 59AE3DFA1ECECD7D003E2C62 /* LiveInforViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveInforViewController.swift; sourceTree = "<group>"; };
337 340 59AE3DFC1ECED5B1003E2C62 /* MoivePlayerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoivePlayerViewController.swift; sourceTree = "<group>"; };
  341 + 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TVStationChannelViewController.swift; sourceTree = "<group>"; };
338 342 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AliyunPlayerSDK.framework; path = YouerLiveVideo/lib/AliyunPlayerSDK.framework; sourceTree = "<group>"; };
339 343 59BA132F1E25D1C000540DE0 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = "<group>"; };
340 344 59BA13301E25D1C000540DE0 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = "<group>"; };
... ... @@ -632,6 +636,8 @@
632 636 5904FC4A1ECA8B8C00E631FF /* TVStation.storyboard */,
633 637 59C25B481ECAD643009FF276 /* MoreTVStationViewController.swift */,
634 638 59C25B4A1ECAD84C009FF276 /* TVStationInforViewController.swift */,
  639 + 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */,
  640 + 595071021ED02C140056E078 /* ExcellentTVViewController.swift */,
635 641 );
636 642 path = TVStation;
637 643 sourceTree = "<group>";
... ... @@ -1464,6 +1470,7 @@
1464 1470 BF7B75A21E305A6D0011D5C7 /* MJRefreshNormalHeader.m in Sources */,
1465 1471 BF7B75991E305A6D0011D5C7 /* MJRefreshFooter.m in Sources */,
1466 1472 59F801571DD2C7AE000A78B0 /* YouerLiveVideo.xcdatamodeld in Sources */,
  1473 + 595071031ED02C140056E078 /* ExcellentTVViewController.swift in Sources */,
1467 1474 59BA13311E25D1C000540DE0 /* Reachability.m in Sources */,
1468 1475 BFBB83EB1ECC445D008B404B /* UserViewController.swift in Sources */,
1469 1476 5904FC4E1ECA8B8C00E631FF /* ResourceViewController.swift in Sources */,
... ... @@ -1491,6 +1498,7 @@
1491 1498 BF7B759C1E305A6D0011D5C7 /* MJRefreshAutoNormalFooter.m in Sources */,
1492 1499 5904FC4F1ECA8B8C00E631FF /* SearchTVStationListViewController.swift in Sources */,
1493 1500 BFC076781E3445F3008BAC79 /* DownLoad.swift in Sources */,
  1501 + 59AE3DFF1ECFDAFD003E2C62 /* TVStationChannelViewController.swift in Sources */,
1494 1502 BF25DFE71DDAA36A003EC0C1 /* MultipartFormData.swift in Sources */,
1495 1503 BF25DFF71DDAA36A003EC0C1 /* MKAnnotationView+WebCache.m in Sources */,
1496 1504 BF25DFFB1DDAA36A003EC0C1 /* SDImageCacheConfig.m in Sources */,
... ...
YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
... ... @@ -186,12 +186,12 @@
186 186 ignoreCount = "0"
187 187 continueAfterRunningActions = "No"
188 188 filePath = "YouerLiveVideo/controllers/TVStation/TVStationViewController.swift"
189   - timestampString = "516614269.896305"
  189 + timestampString = "516957417.700522"
190 190 startingColumnNumber = "9223372036854775807"
191 191 endingColumnNumber = "9223372036854775807"
192   - startingLineNumber = "60"
193   - endingLineNumber = "60"
194   - landmarkName = "tableView(_:viewForHeaderInSection:)"
  192 + startingLineNumber = "61"
  193 + endingLineNumber = "61"
  194 + landmarkName = "getDataList()"
195 195 landmarkType = "7">
196 196 </BreakpointContent>
197 197 </BreakpointProxy>
... ... @@ -201,13 +201,13 @@
201 201 shouldBeEnabled = "Yes"
202 202 ignoreCount = "0"
203 203 continueAfterRunningActions = "No"
204   - filePath = "YouerLiveVideo/controllers/TVStation/TVStationViewController.swift"
205   - timestampString = "516616602.588152"
  204 + filePath = "YouerLiveVideo/controllers/MViewController.swift"
  205 + timestampString = "516618727.367999"
206 206 startingColumnNumber = "9223372036854775807"
207 207 endingColumnNumber = "9223372036854775807"
208   - startingLineNumber = "21"
209   - endingLineNumber = "21"
210   - landmarkName = "pushToSeachViewController()"
  208 + startingLineNumber = "41"
  209 + endingLineNumber = "41"
  210 + landmarkName = "setupOneChildViewController(_:image:selectedImage:controller:isAddNVC:)"
211 211 landmarkType = "7">
212 212 </BreakpointContent>
213 213 </BreakpointProxy>
... ... @@ -217,13 +217,61 @@
217 217 shouldBeEnabled = "Yes"
218 218 ignoreCount = "0"
219 219 continueAfterRunningActions = "No"
220   - filePath = "YouerLiveVideo/controllers/MViewController.swift"
221   - timestampString = "516618727.367999"
  220 + filePath = "YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift"
  221 + timestampString = "517137841.643491"
222 222 startingColumnNumber = "9223372036854775807"
223 223 endingColumnNumber = "9223372036854775807"
224   - startingLineNumber = "41"
225   - endingLineNumber = "41"
226   - landmarkName = "setupOneChildViewController(_:image:selectedImage:controller:isAddNVC:)"
  224 + startingLineNumber = "230"
  225 + endingLineNumber = "230"
  226 + landmarkName = "awakeFromNib()"
  227 + landmarkType = "7">
  228 + <Locations>
  229 + <Location
  230 + shouldBeEnabled = "Yes"
  231 + ignoreCount = "0"
  232 + continueAfterRunningActions = "No"
  233 + symbolName = "YouerLiveVideo.ExcellentTVViewCell.awakeFromNib () -&gt; ()"
  234 + moduleName = "YouerLiveVideo"
  235 + usesParentBreakpointCondition = "Yes"
  236 + urlString = "file:///Users/Manger/Desktop/NewLive/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift"
  237 + timestampString = "517137869.875423"
  238 + startingColumnNumber = "9223372036854775807"
  239 + endingColumnNumber = "9223372036854775807"
  240 + startingLineNumber = "230"
  241 + endingLineNumber = "230"
  242 + offsetFromSymbolStart = "15">
  243 + </Location>
  244 + <Location
  245 + shouldBeEnabled = "Yes"
  246 + ignoreCount = "0"
  247 + continueAfterRunningActions = "No"
  248 + symbolName = "YouerLiveVideo.ExcellentTVViewCell.(awakeFromNib () -&gt; ()).(closure #1)"
  249 + moduleName = "YouerLiveVideo"
  250 + usesParentBreakpointCondition = "Yes"
  251 + urlString = "file:///Users/Manger/Desktop/NewLive/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift"
  252 + timestampString = "517137869.877211"
  253 + startingColumnNumber = "9223372036854775807"
  254 + endingColumnNumber = "9223372036854775807"
  255 + startingLineNumber = "231"
  256 + endingLineNumber = "231"
  257 + offsetFromSymbolStart = "62">
  258 + </Location>
  259 + </Locations>
  260 + </BreakpointContent>
  261 + </BreakpointProxy>
  262 + <BreakpointProxy
  263 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  264 + <BreakpointContent
  265 + shouldBeEnabled = "Yes"
  266 + ignoreCount = "0"
  267 + continueAfterRunningActions = "No"
  268 + filePath = "YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift"
  269 + timestampString = "517137851.595827"
  270 + startingColumnNumber = "9223372036854775807"
  271 + endingColumnNumber = "9223372036854775807"
  272 + startingLineNumber = "206"
  273 + endingLineNumber = "206"
  274 + landmarkName = "collectionView(_:cellForItemAt:)"
227 275 landmarkType = "7">
228 276 </BreakpointContent>
229 277 </BreakpointProxy>
... ...
YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "arrow.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "version" : 1,
  19 + "author" : "xcode"
  20 + },
  21 + "properties" : {
  22 + "template-rendering-intent" : "template"
  23 + }
  24 +}
0 25 \ No newline at end of file
... ...
YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png 0 → 100644

1002 Bytes

YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift
... ... @@ -40,7 +40,9 @@ extension ResourceViewController:UITableViewDelegate,UITableViewDataSource{
40 40 }
41 41  
42 42 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
43   -
  43 + let vc = Story.instantiateViewControllerWithIdentifier("LiveInforViewControllerVC", storyName: "Resource") as! LiveInforViewController
  44 + self.navigationController?.pushViewController(vc, animated: true)
  45 +
44 46 }
45 47  
46 48 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
... ...
YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift 0 → 100644
... ... @@ -0,0 +1,288 @@
  1 +//
  2 +// ExcellentTVViewController.swift
  3 +// YouerLiveVideo
  4 +//
  5 +// Created by 左丞 on 2017/5/20.
  6 +// Copyright © 2017年 左丞. All rights reserved.
  7 +//
  8 +
  9 +import UIKit
  10 +
  11 +class ExcellentTVViewController: UIViewController {
  12 +
  13 + @IBOutlet weak var AllTitleView: UIView!
  14 + var isForbidScrollDelegate:Bool = true
  15 + var startOffsetX:CGFloat = 0
  16 + var TVStationScrollView:UIScrollView!//第一排目录
  17 + @IBOutlet weak var lunboView: UIView!
  18 + @IBOutlet weak var TVStationClass: UIView!
  19 + @IBOutlet weak var collectionView: UICollectionView!
  20 + var TVStationClasses:[TVSubjectInfor] = []
  21 + var titleSelectBtn:Int = 0
  22 + var classSelectBtn:Int = 0
  23 + override func viewDidLoad() {
  24 + super.viewDidLoad()
  25 + AppDelegate.instance().httpServer.getTelevisionStationCatagory(parameters: nil) { (str, error) in
  26 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  27 + for item in json.contentData().arrayValue{
  28 + self.TVStationClasses.append(TVSubjectInfor(json: item))
  29 + }
  30 + self.creatTVStationClassScrollView()
  31 + self.collectionView.reloadData()
  32 + }, failHandler: { (error) in
  33 +
  34 + })
  35 + }
  36 + // Do any additional setup after loading the view.
  37 + }
  38 +
  39 + override func didReceiveMemoryWarning() {
  40 + super.didReceiveMemoryWarning()
  41 + // Dispose of any resources that can be recreated.
  42 + }
  43 +
  44 + func creatTVStationClassScrollView(){
  45 + TVStationScrollView = UIScrollView(frame: CGRect(origin: CGPointZero, size: TVStationClass.frame.size))
  46 + TVStationScrollView.showsHorizontalScrollIndicator = false
  47 + TVStationScrollView.showsVerticalScrollIndicator = false
  48 + TVStationScrollView.bounces = false
  49 + var x:CGFloat = 0
  50 + for (index,item) in TVStationClasses.enumerated() {
  51 + let TVStationClassScrollView = UIScrollView(frame: CGRect(origin: CGPointZero, size: AllTitleView.frame.size))
  52 +
  53 + let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: TVStationClass.frame.size.height))
  54 + btn.backgroundColor = UIColor.white
  55 + btn.setTitleColor(UIColor.black, for: .normal)
  56 + btn.setTitle(item.name, for: .normal)
  57 + btn.sizeToFit()
  58 + if index != 0{
  59 + x = TVStationScrollView.viewWithTag(200+index-1)!.frame.maxX
  60 + TVStationClassScrollView.isHidden = true
  61 + }else{
  62 + x = 0
  63 + TVStationClassScrollView.isHidden = false
  64 + btn.backgroundColor = UIColor.blue
  65 + btn.setTitleColor(UIColor.white, for: .normal)
  66 +
  67 + }
  68 + btn.frame.origin.x = x
  69 + btn.frame.size = CGSize(width: btn.frame.size.width+20, height: TVStationClass.frame.size.height)
  70 + btn.tag = 200+index
  71 + TVStationScrollView.contentSize = CGSize(width: btn.frame.maxX, height: 0)
  72 + btn.addTarget(self, action: #selector(ExcellentTVViewController.TVStationBtnClick(btn:)), for: .touchUpInside)
  73 + TVStationScrollView.addSubview(btn)
  74 +
  75 + TVStationClassScrollView.showsHorizontalScrollIndicator = false
  76 + TVStationClassScrollView.showsVerticalScrollIndicator = false
  77 + TVStationClassScrollView.bounces = false
  78 + TVStationClassScrollView.tag = 2000+index
  79 + for (ind,it) in item.ch.enumerated() {
  80 + let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: TVStationClass.frame.size.height))
  81 + button.backgroundColor = UIColor.white
  82 + button.setTitleColor(UIColor.black, for: .normal)
  83 + button.setTitle(it.name, for: .normal)
  84 + button.sizeToFit()
  85 + if ind != 0{
  86 + x = TVStationClassScrollView.viewWithTag(1000+index*100+ind-1)!.frame.maxX
  87 + }else{
  88 + x = 0
  89 + button.backgroundColor = UIColor.blue
  90 + button.setTitleColor(UIColor.white, for: .normal)
  91 + }
  92 + button.frame.origin.x = x
  93 + button.frame.size = CGSize(width: button.frame.size.width+20, height: TVStationClass.frame.size.height)
  94 + button.tag = 1000+index*100+ind
  95 + TVStationClassScrollView.contentSize = CGSize(width: button.frame.maxX, height: 0)
  96 + button.addTarget(self, action: #selector(ExcellentTVViewController.TVStationClassBtnClick(btn:)), for: .touchUpInside)
  97 + TVStationClassScrollView.addSubview(button)
  98 + }
  99 + TVStationClass.addSubview(TVStationClassScrollView)
  100 + }
  101 + AllTitleView.addSubview(TVStationScrollView)
  102 + }
  103 +
  104 + func TVStationBtnClick(btn:UIButton){
  105 + titleSelectBtn = btn.tag%10
  106 + for i in 0..<TVStationClasses.count{
  107 + let item = AllTitleView.viewWithTag(200+i) as! UIButton
  108 + item.backgroundColor = UIColor.white
  109 + item.setTitleColor(UIColor.black, for: .normal)
  110 + TVStationClass.viewWithTag(2000+i)?.isHidden = true
  111 + }
  112 + btn.setTitleColor(UIColor.white, for: .normal)
  113 + btn.backgroundColor = UIColor.blue
  114 + TVStationClass.viewWithTag(2000+btn.tag%10)?.isHidden = false
  115 + collectionView.reloadData()
  116 + }
  117 +
  118 + func TVStationClassBtnClick(btn:UIButton){
  119 + classSelectBtn = btn.tag%10
  120 + let index = btn.tag%1000/100
  121 + isForbidScrollDelegate = true
  122 + collectionView.scrollToItem(at: IndexPath(item: classSelectBtn, section: 0), at: .centeredHorizontally, animated: false)
  123 + for i in 0..<TVStationClasses[index].ch.count{
  124 + let item = TVStationClass.viewWithTag(2000+titleSelectBtn)!.viewWithTag(1000+100*index+i) as! UIButton
  125 + item.backgroundColor = UIColor.white
  126 + item.setTitleColor(UIColor.black, for: .normal)
  127 + }
  128 + btn.setTitleColor(UIColor.white, for: .normal)
  129 + btn.backgroundColor = UIColor.blue
  130 + }
  131 +
  132 + /*
  133 + // MARK: - Navigation
  134 +
  135 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  136 + override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  137 + // Get the new view controller using segue.destinationViewController.
  138 + // Pass the selected object to the new view controller.
  139 + }
  140 + */
  141 +
  142 +}
  143 +
  144 +
  145 +//下方的所有电视节目所在的collcetionView
  146 +extension ExcellentTVViewController:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
  147 + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
  148 + startOffsetX = scrollView.contentOffset.x
  149 + isForbidScrollDelegate = false
  150 + }
  151 +
  152 + func scrollViewDidScroll(_ scrollView: UIScrollView) {
  153 + if isForbidScrollDelegate { return }
  154 + NSLog("\(scrollView.contentOffset.x)")
  155 + var btn:UIButton!
  156 + var num:CGFloat!
  157 + let btnIndex = scrollView.contentOffset.x/getScreenWidth()
  158 + let view = TVStationClass.viewWithTag(2000+titleSelectBtn)! as! UIScrollView
  159 + if view.contentSize.width > getScreenWidth(){
  160 + if scrollView.contentOffset.x > startOffsetX{
  161 + if scrollView.contentOffset.x - startOffsetX == getScreenWidth(){
  162 + num = btnIndex
  163 + }else{
  164 + num = btnIndex+1
  165 + }
  166 + if Int(num) >= TVStationClasses[titleSelectBtn].ch.count {
  167 + return
  168 + }
  169 + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(num))! as! UIButton
  170 + let TVStationContentOffset = btn.frame.origin.x+btn.frame.width/2
  171 + if TVStationContentOffset < view.contentSize.width-getScreenWidth()/2 && TVStationContentOffset >= getScreenWidth()/2{
  172 + view.contentOffset.x = TVStationContentOffset - getScreenWidth()/2
  173 + }
  174 + if TVStationContentOffset >= view.contentSize.width-getScreenWidth()/2{
  175 + view.contentOffset.x = view.contentSize.width-getScreenWidth()
  176 + }
  177 + }
  178 + else{
  179 + let num = btnIndex
  180 + if num < 0{
  181 + return
  182 + }
  183 + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(num))! as! UIButton
  184 + let TVStationContentOffset = btn.frame.origin.x+btn.frame.width/2
  185 + if TVStationContentOffset < view.contentSize.width-getScreenWidth()/2 && TVStationContentOffset >= getScreenWidth()/2{
  186 + view.contentOffset.x = TVStationContentOffset-getScreenWidth()/2
  187 + }
  188 + if TVStationContentOffset < getScreenWidth()/2{
  189 + view.contentOffset.x = 0
  190 + }
  191 + }
  192 + }else{
  193 + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(btnIndex))! as! UIButton
  194 + }
  195 + for i in 0..<TVStationClasses[titleSelectBtn].ch.count{
  196 + let item = view.viewWithTag(i+1000+100*titleSelectBtn) as! UIButton
  197 + item.backgroundColor = UIColor.white
  198 + item.setTitleColor(UIColor.black, for: .normal)
  199 + }
  200 + btn.setTitleColor(UIColor.white, for: .normal)
  201 + btn.backgroundColor = UIColor.blue
  202 + }
  203 +
  204 + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  205 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! ExcellentTVViewCell
  206 + cell.f_TelevisionId = TVStationClasses[titleSelectBtn].ch[classSelectBtn].id
  207 + return cell
  208 + }
  209 +
  210 + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  211 + if TVStationClasses.count > 0{
  212 + return TVStationClasses[titleSelectBtn].ch.count
  213 + }
  214 + return 0
  215 + }
  216 +
  217 +
  218 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  219 + return CGSize(width: getScreenWidth(), height: collectionView.frame.size.height)
  220 +
  221 + }
  222 +}
  223 +
  224 +//单项选项中的CollectionView
  225 +class ExcellentTVViewCell: UICollectionViewCell,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
  226 + var f_TelevisionId:String!
  227 + @IBOutlet weak var inforCollectionView: UICollectionView!
  228 + var datatSet:[TVStationSubject] = []
  229 +
  230 +
  231 +
  232 + override func awakeFromNib() {
  233 + AppDelegate.instance().httpServer.postExcellentProgram(parameters: ["f_TelevisionId":f_TelevisionId as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in
  234 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  235 + for item in json.contentData().arrayValue{
  236 + self.datatSet.append(TVStationSubject(json: item))
  237 + }
  238 + self.inforCollectionView.reloadData()
  239 + }, failHandler: { (error) in
  240 +
  241 + })
  242 + }
  243 + }
  244 +
  245 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  246 +
  247 + }
  248 +
  249 + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  250 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell1", for: indexPath) as! ExcellentTVInforViewCell
  251 + return cell
  252 + }
  253 +
  254 + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  255 + return datatSet.count
  256 + }
  257 +
  258 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  259 + return CGSize(width: (getScreenWidth()-30)/2, height: 150)
  260 + }
  261 +
  262 +
  263 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
  264 + return UIEdgeInsetsMake(10, 10, 10, 10)
  265 + }
  266 +
  267 +}
  268 +
  269 +class ExcellentTVInforViewCell: UICollectionViewCell{
  270 +
  271 +}
  272 +
  273 +class TVSubjectInfor{
  274 + var id:String!
  275 + var name:String!
  276 + var text:String!
  277 + var open:Bool!
  278 + var ch:[TVSubjectInfor]=[]
  279 + init(json:JSON){
  280 + id = json["id"].stringValue
  281 + name = json["name"].stringValue
  282 + text = json["text"].stringValue
  283 + name = json["name"].stringValue
  284 + for item in json["children"].arrayValue {
  285 + ch.append(TVSubjectInfor(json: item))
  286 + }
  287 + }
  288 +}
... ...
YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard
... ... @@ -85,6 +85,135 @@
85 85 </objects>
86 86 <point key="canvasLocation" x="-570.39999999999998" y="126.38680659670166"/>
87 87 </scene>
  88 + <!--ExcellentTV View Controller-->
  89 + <scene sceneID="l6m-g1-3BP">
  90 + <objects>
  91 + <viewController storyboardIdentifier="ExcellentTVViewControllerVC" id="b8W-aX-LnV" customClass="ExcellentTVViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController">
  92 + <layoutGuides>
  93 + <viewControllerLayoutGuide type="top" id="4i9-Tx-rg9"/>
  94 + <viewControllerLayoutGuide type="bottom" id="lho-df-W25"/>
  95 + </layoutGuides>
  96 + <view key="view" contentMode="scaleToFill" id="Gv8-KK-Axo">
  97 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  98 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  99 + <subviews>
  100 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Mhl-sd-KB9">
  101 + <rect key="frame" x="0.0" y="64" width="375" height="157"/>
  102 + <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
  103 + <constraints>
  104 + <constraint firstAttribute="height" constant="157" id="UZ0-MV-VXA"/>
  105 + </constraints>
  106 + </view>
  107 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="89T-Tx-OBE">
  108 + <rect key="frame" x="0.0" y="272" width="375" height="51"/>
  109 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
  110 + <constraints>
  111 + <constraint firstAttribute="height" constant="51" id="Y6f-tb-9yg"/>
  112 + </constraints>
  113 + </view>
  114 + <searchBar contentMode="redraw" placeholder="搜索" translatesAutoresizingMaskIntoConstraints="NO" id="zGg-HQ-hQ6">
  115 + <rect key="frame" x="0.0" y="20" width="375" height="44"/>
  116 + <textInputTraits key="textInputTraits"/>
  117 + </searchBar>
  118 + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="98q-Zu-qPj">
  119 + <rect key="frame" x="0.0" y="323" width="375" height="344"/>
  120 + <color key="backgroundColor" red="0.89713114500000002" green="0.89431768659999999" blue="0.90413767099999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  121 + <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="Y8d-tF-Eyu">
  122 + <size key="itemSize" width="376" height="392"/>
  123 + <size key="headerReferenceSize" width="0.0" height="0.0"/>
  124 + <size key="footerReferenceSize" width="0.0" height="0.0"/>
  125 + <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
  126 + </collectionViewFlowLayout>
  127 + <cells>
  128 + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="fGR-8c-fGE" customClass="ExcellentTVViewCell" customModule="YouerLiveVideo" customModuleProvider="target">
  129 + <rect key="frame" x="0.0" y="-24" width="376" height="392"/>
  130 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  131 + <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
  132 + <rect key="frame" x="0.0" y="0.0" width="376" height="392"/>
  133 + <autoresizingMask key="autoresizingMask"/>
  134 + <subviews>
  135 + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="r6p-zi-d85">
  136 + <rect key="frame" x="0.0" y="0.0" width="376" height="392"/>
  137 + <color key="backgroundColor" red="0.89713114500000002" green="0.89431768659999999" blue="0.90413767099999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  138 + <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="cgF-Y1-nnf">
  139 + <size key="itemSize" width="170" height="167"/>
  140 + <size key="headerReferenceSize" width="0.0" height="0.0"/>
  141 + <size key="footerReferenceSize" width="0.0" height="0.0"/>
  142 + <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
  143 + </collectionViewFlowLayout>
  144 + <cells>
  145 + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell1" id="E1U-aK-U8z" customClass="ExcellentTVInforViewCell" customModule="YouerLiveVideo" customModuleProvider="target">
  146 + <rect key="frame" x="0.0" y="0.0" width="170" height="167"/>
  147 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  148 + <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
  149 + <rect key="frame" x="0.0" y="0.0" width="170" height="167"/>
  150 + <autoresizingMask key="autoresizingMask"/>
  151 + </view>
  152 + <color key="backgroundColor" red="0.024445036430000001" green="0.37366014720000001" blue="0.72428816559999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  153 + </collectionViewCell>
  154 + </cells>
  155 + <connections>
  156 + <outlet property="dataSource" destination="fGR-8c-fGE" id="u36-wA-CKH"/>
  157 + <outlet property="delegate" destination="fGR-8c-fGE" id="IBZ-Vo-3of"/>
  158 + </connections>
  159 + </collectionView>
  160 + </subviews>
  161 + </view>
  162 + <constraints>
  163 + <constraint firstItem="r6p-zi-d85" firstAttribute="leading" secondItem="fGR-8c-fGE" secondAttribute="leading" id="XnS-Y3-JXe"/>
  164 + <constraint firstAttribute="bottom" secondItem="r6p-zi-d85" secondAttribute="bottom" id="Zyh-g8-MW7"/>
  165 + <constraint firstAttribute="trailing" secondItem="r6p-zi-d85" secondAttribute="trailing" id="dK8-ok-Snv"/>
  166 + <constraint firstItem="r6p-zi-d85" firstAttribute="top" secondItem="fGR-8c-fGE" secondAttribute="top" id="iDI-iF-maj"/>
  167 + </constraints>
  168 + <connections>
  169 + <outlet property="inforCollectionView" destination="r6p-zi-d85" id="XvH-nv-OHv"/>
  170 + </connections>
  171 + </collectionViewCell>
  172 + </cells>
  173 + <connections>
  174 + <outlet property="dataSource" destination="b8W-aX-LnV" id="CCT-nv-YZq"/>
  175 + <outlet property="delegate" destination="b8W-aX-LnV" id="1Cr-xP-bzP"/>
  176 + </connections>
  177 + </collectionView>
  178 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IdI-17-KVq">
  179 + <rect key="frame" x="0.0" y="221" width="375" height="51"/>
  180 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
  181 + <constraints>
  182 + <constraint firstAttribute="height" constant="51" id="unU-1q-P1u"/>
  183 + </constraints>
  184 + </view>
  185 + </subviews>
  186 + <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
  187 + <constraints>
  188 + <constraint firstItem="zGg-HQ-hQ6" firstAttribute="leading" secondItem="Gv8-KK-Axo" secondAttribute="leading" id="08r-BK-AYj"/>
  189 + <constraint firstAttribute="trailing" secondItem="IdI-17-KVq" secondAttribute="trailing" id="5vb-9d-uXn"/>
  190 + <constraint firstItem="IdI-17-KVq" firstAttribute="top" secondItem="Mhl-sd-KB9" secondAttribute="bottom" id="7rQ-6N-24t"/>
  191 + <constraint firstAttribute="trailing" secondItem="98q-Zu-qPj" secondAttribute="trailing" id="9fs-x7-fIS"/>
  192 + <constraint firstItem="IdI-17-KVq" firstAttribute="leading" secondItem="Gv8-KK-Axo" secondAttribute="leading" id="F2C-pE-qYZ"/>
  193 + <constraint firstItem="zGg-HQ-hQ6" firstAttribute="top" secondItem="4i9-Tx-rg9" secondAttribute="bottom" id="J68-Pn-0Bu"/>
  194 + <constraint firstAttribute="trailing" secondItem="Mhl-sd-KB9" secondAttribute="trailing" id="Lt7-n0-tWt"/>
  195 + <constraint firstItem="lho-df-W25" firstAttribute="top" secondItem="98q-Zu-qPj" secondAttribute="bottom" id="MIT-SW-TOS"/>
  196 + <constraint firstItem="89T-Tx-OBE" firstAttribute="leading" secondItem="Gv8-KK-Axo" secondAttribute="leading" id="NED-o8-Gz5"/>
  197 + <constraint firstItem="89T-Tx-OBE" firstAttribute="top" secondItem="IdI-17-KVq" secondAttribute="bottom" id="Pc7-DI-fyn"/>
  198 + <constraint firstAttribute="trailing" secondItem="zGg-HQ-hQ6" secondAttribute="trailing" id="WPf-27-9bg"/>
  199 + <constraint firstItem="Mhl-sd-KB9" firstAttribute="leading" secondItem="Gv8-KK-Axo" secondAttribute="leading" id="anA-G9-sCy"/>
  200 + <constraint firstItem="98q-Zu-qPj" firstAttribute="leading" secondItem="Gv8-KK-Axo" secondAttribute="leading" id="coP-ED-djd"/>
  201 + <constraint firstAttribute="trailing" secondItem="89T-Tx-OBE" secondAttribute="trailing" id="d3u-hS-Fv0"/>
  202 + <constraint firstItem="98q-Zu-qPj" firstAttribute="top" secondItem="89T-Tx-OBE" secondAttribute="bottom" id="vDI-ni-7Iu"/>
  203 + <constraint firstItem="Mhl-sd-KB9" firstAttribute="top" secondItem="zGg-HQ-hQ6" secondAttribute="bottom" id="zJx-8Q-hdK"/>
  204 + </constraints>
  205 + </view>
  206 + <connections>
  207 + <outlet property="AllTitleView" destination="IdI-17-KVq" id="q4z-D9-yZi"/>
  208 + <outlet property="TVStationClass" destination="89T-Tx-OBE" id="ru3-Dy-X1Z"/>
  209 + <outlet property="collectionView" destination="98q-Zu-qPj" id="0J9-bV-tnM"/>
  210 + <outlet property="lunboView" destination="Mhl-sd-KB9" id="R0Q-io-hip"/>
  211 + </connections>
  212 + </viewController>
  213 + <placeholder placeholderIdentifier="IBFirstResponder" id="KWc-cP-YUd" userLabel="First Responder" sceneMemberID="firstResponder"/>
  214 + </objects>
  215 + <point key="canvasLocation" x="-572" y="785.75712143928047"/>
  216 + </scene>
88 217 <!--SearchTV Station List View Controller-->
89 218 <scene sceneID="FC9-ii-4gV">
90 219 <objects>
... ... @@ -408,5 +537,127 @@
408 537 </objects>
409 538 <point key="canvasLocation" x="799.20000000000005" y="129.98500749625188"/>
410 539 </scene>
  540 + <!--Station Channel View Controller-->
  541 + <scene sceneID="9jT-qD-wyU">
  542 + <objects>
  543 + <viewController storyboardIdentifier="TVStationChannelViewControllerVC" id="CLL-z0-29E" customClass="TVStationChannelViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController">
  544 + <layoutGuides>
  545 + <viewControllerLayoutGuide type="top" id="Lr1-Rk-hqR"/>
  546 + <viewControllerLayoutGuide type="bottom" id="PET-wp-1k0"/>
  547 + </layoutGuides>
  548 + <view key="view" contentMode="scaleToFill" id="1fP-l5-4K3">
  549 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  550 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  551 + <subviews>
  552 + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="EVv-oR-qoV">
  553 + <rect key="frame" x="0.0" y="20" width="375" height="647"/>
  554 + <color key="backgroundColor" red="0.89713114500000002" green="0.89431768659999999" blue="0.90413767099999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  555 + <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="nT1-EI-DzL">
  556 + <size key="itemSize" width="160" height="176"/>
  557 + <size key="headerReferenceSize" width="50" height="50"/>
  558 + <size key="footerReferenceSize" width="0.0" height="0.0"/>
  559 + <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
  560 + </collectionViewFlowLayout>
  561 + <cells>
  562 + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="XS8-dM-fSF" customClass="TVStationChannelCell" customModule="YouerLiveVideo" customModuleProvider="target">
  563 + <rect key="frame" x="0.0" y="50" width="160" height="176"/>
  564 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
  565 + <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
  566 + <rect key="frame" x="0.0" y="0.0" width="160" height="176"/>
  567 + <autoresizingMask key="autoresizingMask"/>
  568 + <subviews>
  569 + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1ZJ-ao-hBx">
  570 + <rect key="frame" x="0.0" y="0.0" width="160" height="120"/>
  571 + <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
  572 + </imageView>
  573 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EE2-Y8-SP4">
  574 + <rect key="frame" x="59" y="139" width="42" height="21"/>
  575 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  576 + <nil key="textColor"/>
  577 + <nil key="highlightedColor"/>
  578 + </label>
  579 + </subviews>
  580 + </view>
  581 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
  582 + <constraints>
  583 + <constraint firstAttribute="bottom" secondItem="EE2-Y8-SP4" secondAttribute="bottom" constant="16" id="6w0-JP-ybD"/>
  584 + <constraint firstItem="1ZJ-ao-hBx" firstAttribute="leading" secondItem="XS8-dM-fSF" secondAttribute="leading" id="Fdm-sT-5np"/>
  585 + <constraint firstItem="1ZJ-ao-hBx" firstAttribute="top" secondItem="XS8-dM-fSF" secondAttribute="top" id="HmI-98-WDB"/>
  586 + <constraint firstItem="EE2-Y8-SP4" firstAttribute="top" secondItem="1ZJ-ao-hBx" secondAttribute="bottom" constant="19" id="KZ9-YD-2dJ"/>
  587 + <constraint firstItem="EE2-Y8-SP4" firstAttribute="centerX" secondItem="XS8-dM-fSF" secondAttribute="centerX" id="nFb-gE-ru0"/>
  588 + <constraint firstAttribute="trailing" secondItem="1ZJ-ao-hBx" secondAttribute="trailing" id="p1m-WJ-Z3K"/>
  589 + </constraints>
  590 + <connections>
  591 + <outlet property="tvStationLogo" destination="1ZJ-ao-hBx" id="1NC-ds-qqX"/>
  592 + <outlet property="tvStationName" destination="EE2-Y8-SP4" id="lSz-1S-YnW"/>
  593 + </connections>
  594 + </collectionViewCell>
  595 + </cells>
  596 + <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="HeaderView" id="Jdh-dY-FAu" customClass="TVStationChannelHeaderView" customModule="YouerLiveVideo" customModuleProvider="target">
  597 + <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
  598 + <autoresizingMask key="autoresizingMask"/>
  599 + <subviews>
  600 + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8TH-3g-UsI">
  601 + <rect key="frame" x="8" y="7" width="35" height="35"/>
  602 + <constraints>
  603 + <constraint firstAttribute="height" constant="35" id="5yj-bt-Jn8"/>
  604 + <constraint firstAttribute="width" secondItem="8TH-3g-UsI" secondAttribute="height" multiplier="1:1" id="Kxf-yE-A3T"/>
  605 + </constraints>
  606 + </imageView>
  607 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yem-uG-4a8">
  608 + <rect key="frame" x="51" y="14" width="42" height="21"/>
  609 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
  610 + <nil key="textColor"/>
  611 + <nil key="highlightedColor"/>
  612 + </label>
  613 + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HPj-Yv-YzO">
  614 + <rect key="frame" x="337" y="10" width="30" height="30"/>
  615 + <constraints>
  616 + <constraint firstAttribute="height" constant="30" id="tPQ-hz-bM8"/>
  617 + <constraint firstAttribute="width" constant="30" id="weL-na-eER"/>
  618 + </constraints>
  619 + <state key="normal" image="arrow"/>
  620 + </button>
  621 + </subviews>
  622 + <constraints>
  623 + <constraint firstItem="yem-uG-4a8" firstAttribute="leading" secondItem="8TH-3g-UsI" secondAttribute="trailing" constant="8" id="3hn-Wo-NOT"/>
  624 + <constraint firstItem="HPj-Yv-YzO" firstAttribute="centerY" secondItem="Jdh-dY-FAu" secondAttribute="centerY" id="HS5-Sr-TvH"/>
  625 + <constraint firstAttribute="trailing" secondItem="HPj-Yv-YzO" secondAttribute="trailing" constant="8" id="Ih6-EB-p7N"/>
  626 + <constraint firstItem="yem-uG-4a8" firstAttribute="centerY" secondItem="Jdh-dY-FAu" secondAttribute="centerY" id="Xvl-o7-bO2"/>
  627 + <constraint firstItem="8TH-3g-UsI" firstAttribute="centerY" secondItem="Jdh-dY-FAu" secondAttribute="centerY" id="fy9-TI-eoE"/>
  628 + <constraint firstItem="HPj-Yv-YzO" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="yem-uG-4a8" secondAttribute="trailing" constant="8" id="k2d-sv-rfG"/>
  629 + <constraint firstItem="8TH-3g-UsI" firstAttribute="leading" secondItem="Jdh-dY-FAu" secondAttribute="leading" constant="8" id="wQg-ux-5gP"/>
  630 + </constraints>
  631 + <connections>
  632 + <outlet property="logo" destination="8TH-3g-UsI" id="3e0-Qr-HHs"/>
  633 + <outlet property="moreBtn" destination="HPj-Yv-YzO" id="CXg-Sc-E5B"/>
  634 + <outlet property="title" destination="yem-uG-4a8" id="jgP-c2-8rY"/>
  635 + </connections>
  636 + </collectionReusableView>
  637 + <connections>
  638 + <outlet property="dataSource" destination="CLL-z0-29E" id="maz-ws-hfl"/>
  639 + <outlet property="delegate" destination="CLL-z0-29E" id="EEF-Mt-3m2"/>
  640 + </connections>
  641 + </collectionView>
  642 + </subviews>
  643 + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
  644 + <constraints>
  645 + <constraint firstItem="PET-wp-1k0" firstAttribute="top" secondItem="EVv-oR-qoV" secondAttribute="bottom" id="E8l-rG-D5Z"/>
  646 + <constraint firstItem="EVv-oR-qoV" firstAttribute="leading" secondItem="1fP-l5-4K3" secondAttribute="leading" id="eWd-hq-hwR"/>
  647 + <constraint firstItem="EVv-oR-qoV" firstAttribute="top" secondItem="Lr1-Rk-hqR" secondAttribute="bottom" id="l0i-7E-YUv"/>
  648 + <constraint firstAttribute="trailing" secondItem="EVv-oR-qoV" secondAttribute="trailing" id="xf3-fQ-aK5"/>
  649 + </constraints>
  650 + </view>
  651 + <connections>
  652 + <outlet property="collectionView" destination="EVv-oR-qoV" id="B1b-Pw-i7S"/>
  653 + </connections>
  654 + </viewController>
  655 + <placeholder placeholderIdentifier="IBFirstResponder" id="Thy-DG-e5P" userLabel="First Responder" sceneMemberID="firstResponder"/>
  656 + </objects>
  657 + <point key="canvasLocation" x="93.599999999999994" y="785.75712143928047"/>
  658 + </scene>
411 659 </scenes>
  660 + <resources>
  661 + <image name="arrow" width="13" height="13"/>
  662 + </resources>
412 663 </document>
... ...
YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift 0 → 100644
... ... @@ -0,0 +1,108 @@
  1 +//
  2 +// TVStationChannelViewController.swift
  3 +// YouerLiveVideo
  4 +//
  5 +// Created by 左丞 on 2017/5/20.
  6 +// Copyright © 2017年 左丞. All rights reserved.
  7 +//
  8 +
  9 +import UIKit
  10 +
  11 +class TVStationChannelViewController: UIViewController {
  12 +
  13 + @IBOutlet weak var collectionView: UICollectionView!
  14 + var typeList:[String] = ["直播节目","点播"]
  15 + override func viewDidLoad() {
  16 + super.viewDidLoad()
  17 + self.automaticallyAdjustsScrollViewInsets = false
  18 + // Do any additional setup after loading the view.
  19 + }
  20 +
  21 + override func didReceiveMemoryWarning() {
  22 + super.didReceiveMemoryWarning()
  23 + // Dispose of any resources that can be recreated.
  24 + }
  25 +
  26 +
  27 + func moreBtnClick(send:UIButton){
  28 +
  29 + }
  30 +
  31 + /*
  32 + // MARK: - Navigation
  33 +
  34 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  35 + override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  36 + // Get the new view controller using segue.destinationViewController.
  37 + // Pass the selected object to the new view controller.
  38 + }
  39 + */
  40 +
  41 +}
  42 +
  43 +extension TVStationChannelViewController:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
  44 + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  45 +
  46 + }
  47 +
  48 + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  49 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
  50 + return cell
  51 + }
  52 +
  53 + func numberOfSections(in collectionView: UICollectionView) -> Int {
  54 + return 2
  55 + }
  56 +
  57 + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  58 + return 4
  59 + }
  60 +
  61 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
  62 + return CGSize(width: getScreenWidth(), height: 44)
  63 + }
  64 +
  65 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
  66 + return UIEdgeInsetsMake(10, 10, 10, 10)
  67 + }
  68 +
  69 +
  70 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  71 + return CGSize(width: (getScreenWidth()-30)/2, height: 200)
  72 + }
  73 +
  74 + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
  75 + var reusableView:UICollectionReusableView!
  76 + if kind == UICollectionElementKindSectionHeader{
  77 + let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "HeaderView", for: indexPath) as! TVStationChannelHeaderView
  78 + headerView.title.text = typeList[indexPath.section]
  79 + headerView.moreBtn.tag = 100+indexPath.section
  80 + headerView.moreBtn.addTarget(self, action: #selector(TVStationChannelViewController.moreBtnClick(send:)), for: .touchUpInside)
  81 + headerView.logo.image = UIImage(named: "icon")
  82 + reusableView = headerView
  83 + }
  84 + return reusableView
  85 + }
  86 +
  87 +}
  88 +
  89 +class TVStationChannelCell: UICollectionViewCell {
  90 +
  91 + @IBOutlet weak var tvStationLogo: UIImageView!
  92 + @IBOutlet weak var tvStationName: UILabel!
  93 +}
  94 +
  95 +
  96 +class TVStationChannelHeaderView: UICollectionReusableView {
  97 +
  98 +
  99 + @IBOutlet weak var moreBtn: UIButton!
  100 + @IBOutlet weak var logo: UIImageView!
  101 + @IBOutlet weak var title: UILabel!
  102 +
  103 +}
  104 +
  105 +
  106 +
  107 +
  108 +
... ...
YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift
... ... @@ -19,6 +19,7 @@ class TVStationViewController: UIViewController {
19 19 super.viewDidLoad()
20 20 self.configTheme()
21 21 getDataList()
  22 + self.automaticallyAdjustsScrollViewInsets = false
22 23 self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .search, target: self, action: #selector(TVStationViewController.pushToSeachViewController))
23 24 // Do any additional setup after loading the view.
24 25 }
... ... @@ -147,11 +148,10 @@ extension TVStationViewController:UICollectionViewDelegate,UICollectionViewDeleg
147 148  
148 149 func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
149 150 if collectionView.tag == 3{
150   - let vc = Story.instantiateViewControllerWithIdentifier("TVStationInforViewControllerVC", storyName: "TVStation") as! TVStationInforViewController
151   - vc.excellentTVStationProgram = excellentTVStationProgram[indexPath.row]
  151 + let vc = Story.instantiateViewControllerWithIdentifier("ExcellentTVViewControllerVC", storyName: "TVStation") as! ExcellentTVViewController
152 152 self.navigationController?.pushViewController(vc, animated: true)
153 153 }else{
154   - let vc = Story.instantiateViewControllerWithIdentifier("LiveInforViewControllerVC", storyName: "Resource") as! LiveInforViewController
  154 + let vc = Story.instantiateViewControllerWithIdentifier("TVStationChannelViewControllerVC", storyName: "TVStation") as! TVStationChannelViewController
155 155 self.navigationController?.pushViewController(vc, animated: true)
156 156 }
157 157 }
... ...