From 6337a8d40fba3de3d9b4c0f2fd73f649266695bd Mon Sep 17 00:00:00 2001 From: 左丞 Date: Mon, 22 May 2017 17:25:48 +0800 Subject: [PATCH] no message --- YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj | 8 ++++++++ YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate | Bin 42015 -> 0 bytes YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json | 24 ++++++++++++++++++++++++ YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png | Bin 0 -> 1002 bytes YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift | 4 +++- YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift | 288 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift | 6 +++--- 10 files changed, 747 insertions(+), 18 deletions(-) create mode 100644 YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json create mode 100644 YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png create mode 100644 YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift create mode 100644 YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj index b2f2ee4..866ee4d 100644 --- a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj +++ b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 5904FC531ECA8BB500E631FF /* MicroCourse.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5904FC521ECA8BB500E631FF /* MicroCourse.storyboard */; }; 5904FC551ECA8BCB00E631FF /* HomePage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5904FC541ECA8BCB00E631FF /* HomePage.storyboard */; }; 5904FC611ECA930D00E631FF /* MViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5904FC601ECA930D00E631FF /* MViewController.swift */; }; + 595071031ED02C140056E078 /* ExcellentTVViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 595071021ED02C140056E078 /* ExcellentTVViewController.swift */; }; 5960263B1DD94D3100C6B5E8 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263A1DD94D3100C6B5E8 /* libsqlite3.tbd */; }; 5960263D1DD94D5E00C6B5E8 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263C1DD94D5E00C6B5E8 /* libc++.tbd */; }; 5960263F1DD94D7D00C6B5E8 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5960263E1DD94D7D00C6B5E8 /* ImageIO.framework */; }; @@ -49,6 +50,7 @@ 59AE3DF91ECE8A90003E2C62 /* pinyin.c in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DF71ECE8A90003E2C62 /* pinyin.c */; }; 59AE3DFB1ECECD7D003E2C62 /* LiveInforViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFA1ECECD7D003E2C62 /* LiveInforViewController.swift */; }; 59AE3DFD1ECED5B1003E2C62 /* MoivePlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFC1ECED5B1003E2C62 /* MoivePlayerViewController.swift */; }; + 59AE3DFF1ECFDAFD003E2C62 /* TVStationChannelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */; }; 59BA13251E25CF2B00540DE0 /* AliyunPlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */; }; 59BA13271E25CF4B00540DE0 /* AliyunPlayerSDK.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 59BA13311E25D1C000540DE0 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 59BA13301E25D1C000540DE0 /* Reachability.m */; }; @@ -221,6 +223,7 @@ 5904FC521ECA8BB500E631FF /* MicroCourse.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MicroCourse.storyboard; sourceTree = ""; }; 5904FC541ECA8BCB00E631FF /* HomePage.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = HomePage.storyboard; sourceTree = ""; }; 5904FC601ECA930D00E631FF /* MViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MViewController.swift; sourceTree = ""; }; + 595071021ED02C140056E078 /* ExcellentTVViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExcellentTVViewController.swift; sourceTree = ""; }; 5960263A1DD94D3100C6B5E8 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 5960263C1DD94D5E00C6B5E8 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 5960263E1DD94D7D00C6B5E8 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; @@ -335,6 +338,7 @@ 59AE3DF81ECE8A90003E2C62 /* pinyin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pinyin.h; sourceTree = ""; }; 59AE3DFA1ECECD7D003E2C62 /* LiveInforViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveInforViewController.swift; sourceTree = ""; }; 59AE3DFC1ECED5B1003E2C62 /* MoivePlayerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoivePlayerViewController.swift; sourceTree = ""; }; + 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TVStationChannelViewController.swift; sourceTree = ""; }; 59BA13241E25CF2B00540DE0 /* AliyunPlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AliyunPlayerSDK.framework; path = YouerLiveVideo/lib/AliyunPlayerSDK.framework; sourceTree = ""; }; 59BA132F1E25D1C000540DE0 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; 59BA13301E25D1C000540DE0 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; @@ -632,6 +636,8 @@ 5904FC4A1ECA8B8C00E631FF /* TVStation.storyboard */, 59C25B481ECAD643009FF276 /* MoreTVStationViewController.swift */, 59C25B4A1ECAD84C009FF276 /* TVStationInforViewController.swift */, + 59AE3DFE1ECFDAFD003E2C62 /* TVStationChannelViewController.swift */, + 595071021ED02C140056E078 /* ExcellentTVViewController.swift */, ); path = TVStation; sourceTree = ""; @@ -1464,6 +1470,7 @@ BF7B75A21E305A6D0011D5C7 /* MJRefreshNormalHeader.m in Sources */, BF7B75991E305A6D0011D5C7 /* MJRefreshFooter.m in Sources */, 59F801571DD2C7AE000A78B0 /* YouerLiveVideo.xcdatamodeld in Sources */, + 595071031ED02C140056E078 /* ExcellentTVViewController.swift in Sources */, 59BA13311E25D1C000540DE0 /* Reachability.m in Sources */, BFBB83EB1ECC445D008B404B /* UserViewController.swift in Sources */, 5904FC4E1ECA8B8C00E631FF /* ResourceViewController.swift in Sources */, @@ -1491,6 +1498,7 @@ BF7B759C1E305A6D0011D5C7 /* MJRefreshAutoNormalFooter.m in Sources */, 5904FC4F1ECA8B8C00E631FF /* SearchTVStationListViewController.swift in Sources */, BFC076781E3445F3008BAC79 /* DownLoad.swift in Sources */, + 59AE3DFF1ECFDAFD003E2C62 /* TVStationChannelViewController.swift in Sources */, BF25DFE71DDAA36A003EC0C1 /* MultipartFormData.swift in Sources */, BF25DFF71DDAA36A003EC0C1 /* MKAnnotationView+WebCache.m in Sources */, BF25DFFB1DDAA36A003EC0C1 /* SDImageCacheConfig.m in Sources */, diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate index 0704ecc..d69aadc 100644 Binary files a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate and b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.xcworkspace/xcuserdata/Manger.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index af30dfe..c18f1ba 100644 --- a/YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/YouerLiveVideo/YouerLiveVideo.xcodeproj/xcuserdata/Manger.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -186,12 +186,12 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "YouerLiveVideo/controllers/TVStation/TVStationViewController.swift" - timestampString = "516614269.896305" + timestampString = "516957417.700522" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "60" - endingLineNumber = "60" - landmarkName = "tableView(_:viewForHeaderInSection:)" + startingLineNumber = "61" + endingLineNumber = "61" + landmarkName = "getDataList()" landmarkType = "7"> @@ -201,13 +201,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "YouerLiveVideo/controllers/TVStation/TVStationViewController.swift" - timestampString = "516616602.588152" + filePath = "YouerLiveVideo/controllers/MViewController.swift" + timestampString = "516618727.367999" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "21" - endingLineNumber = "21" - landmarkName = "pushToSeachViewController()" + startingLineNumber = "41" + endingLineNumber = "41" + landmarkName = "setupOneChildViewController(_:image:selectedImage:controller:isAddNVC:)" landmarkType = "7"> @@ -217,13 +217,61 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "YouerLiveVideo/controllers/MViewController.swift" - timestampString = "516618727.367999" + filePath = "YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift" + timestampString = "517137841.643491" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "41" - endingLineNumber = "41" - landmarkName = "setupOneChildViewController(_:image:selectedImage:controller:isAddNVC:)" + startingLineNumber = "230" + endingLineNumber = "230" + landmarkName = "awakeFromNib()" + landmarkType = "7"> + + + + + + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json new file mode 100644 index 0000000..2c3f4d1 --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "arrow.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png new file mode 100644 index 0000000..da7cfa5 Binary files /dev/null and b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/arrow.imageset/arrow.png differ diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift index 6ed4a64..67edc3f 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift @@ -40,7 +40,9 @@ extension ResourceViewController:UITableViewDelegate,UITableViewDataSource{ } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - + let vc = Story.instantiateViewControllerWithIdentifier("LiveInforViewControllerVC", storyName: "Resource") as! LiveInforViewController + self.navigationController?.pushViewController(vc, animated: true) + } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift new file mode 100644 index 0000000..9dbd245 --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift @@ -0,0 +1,288 @@ +// +// ExcellentTVViewController.swift +// YouerLiveVideo +// +// Created by 左丞 on 2017/5/20. +// Copyright © 2017年 左丞. All rights reserved. +// + +import UIKit + +class ExcellentTVViewController: UIViewController { + + @IBOutlet weak var AllTitleView: UIView! + var isForbidScrollDelegate:Bool = true + var startOffsetX:CGFloat = 0 + var TVStationScrollView:UIScrollView!//第一排目录 + @IBOutlet weak var lunboView: UIView! + @IBOutlet weak var TVStationClass: UIView! + @IBOutlet weak var collectionView: UICollectionView! + var TVStationClasses:[TVSubjectInfor] = [] + var titleSelectBtn:Int = 0 + var classSelectBtn:Int = 0 + override func viewDidLoad() { + super.viewDidLoad() + AppDelegate.instance().httpServer.getTelevisionStationCatagory(parameters: nil) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData().arrayValue{ + self.TVStationClasses.append(TVSubjectInfor(json: item)) + } + self.creatTVStationClassScrollView() + self.collectionView.reloadData() + }, failHandler: { (error) in + + }) + } + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + func creatTVStationClassScrollView(){ + TVStationScrollView = UIScrollView(frame: CGRect(origin: CGPointZero, size: TVStationClass.frame.size)) + TVStationScrollView.showsHorizontalScrollIndicator = false + TVStationScrollView.showsVerticalScrollIndicator = false + TVStationScrollView.bounces = false + var x:CGFloat = 0 + for (index,item) in TVStationClasses.enumerated() { + let TVStationClassScrollView = UIScrollView(frame: CGRect(origin: CGPointZero, size: AllTitleView.frame.size)) + + let btn = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: TVStationClass.frame.size.height)) + btn.backgroundColor = UIColor.white + btn.setTitleColor(UIColor.black, for: .normal) + btn.setTitle(item.name, for: .normal) + btn.sizeToFit() + if index != 0{ + x = TVStationScrollView.viewWithTag(200+index-1)!.frame.maxX + TVStationClassScrollView.isHidden = true + }else{ + x = 0 + TVStationClassScrollView.isHidden = false + btn.backgroundColor = UIColor.blue + btn.setTitleColor(UIColor.white, for: .normal) + + } + btn.frame.origin.x = x + btn.frame.size = CGSize(width: btn.frame.size.width+20, height: TVStationClass.frame.size.height) + btn.tag = 200+index + TVStationScrollView.contentSize = CGSize(width: btn.frame.maxX, height: 0) + btn.addTarget(self, action: #selector(ExcellentTVViewController.TVStationBtnClick(btn:)), for: .touchUpInside) + TVStationScrollView.addSubview(btn) + + TVStationClassScrollView.showsHorizontalScrollIndicator = false + TVStationClassScrollView.showsVerticalScrollIndicator = false + TVStationClassScrollView.bounces = false + TVStationClassScrollView.tag = 2000+index + for (ind,it) in item.ch.enumerated() { + let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: TVStationClass.frame.size.height)) + button.backgroundColor = UIColor.white + button.setTitleColor(UIColor.black, for: .normal) + button.setTitle(it.name, for: .normal) + button.sizeToFit() + if ind != 0{ + x = TVStationClassScrollView.viewWithTag(1000+index*100+ind-1)!.frame.maxX + }else{ + x = 0 + button.backgroundColor = UIColor.blue + button.setTitleColor(UIColor.white, for: .normal) + } + button.frame.origin.x = x + button.frame.size = CGSize(width: button.frame.size.width+20, height: TVStationClass.frame.size.height) + button.tag = 1000+index*100+ind + TVStationClassScrollView.contentSize = CGSize(width: button.frame.maxX, height: 0) + button.addTarget(self, action: #selector(ExcellentTVViewController.TVStationClassBtnClick(btn:)), for: .touchUpInside) + TVStationClassScrollView.addSubview(button) + } + TVStationClass.addSubview(TVStationClassScrollView) + } + AllTitleView.addSubview(TVStationScrollView) + } + + func TVStationBtnClick(btn:UIButton){ + titleSelectBtn = btn.tag%10 + for i in 0.. getScreenWidth(){ + if scrollView.contentOffset.x > startOffsetX{ + if scrollView.contentOffset.x - startOffsetX == getScreenWidth(){ + num = btnIndex + }else{ + num = btnIndex+1 + } + if Int(num) >= TVStationClasses[titleSelectBtn].ch.count { + return + } + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(num))! as! UIButton + let TVStationContentOffset = btn.frame.origin.x+btn.frame.width/2 + if TVStationContentOffset < view.contentSize.width-getScreenWidth()/2 && TVStationContentOffset >= getScreenWidth()/2{ + view.contentOffset.x = TVStationContentOffset - getScreenWidth()/2 + } + if TVStationContentOffset >= view.contentSize.width-getScreenWidth()/2{ + view.contentOffset.x = view.contentSize.width-getScreenWidth() + } + } + else{ + let num = btnIndex + if num < 0{ + return + } + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(num))! as! UIButton + let TVStationContentOffset = btn.frame.origin.x+btn.frame.width/2 + if TVStationContentOffset < view.contentSize.width-getScreenWidth()/2 && TVStationContentOffset >= getScreenWidth()/2{ + view.contentOffset.x = TVStationContentOffset-getScreenWidth()/2 + } + if TVStationContentOffset < getScreenWidth()/2{ + view.contentOffset.x = 0 + } + } + }else{ + btn = view.viewWithTag(1000+100*titleSelectBtn+Int(btnIndex))! as! UIButton + } + for i in 0.. UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! ExcellentTVViewCell + cell.f_TelevisionId = TVStationClasses[titleSelectBtn].ch[classSelectBtn].id + return cell + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + if TVStationClasses.count > 0{ + return TVStationClasses[titleSelectBtn].ch.count + } + return 0 + } + + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: getScreenWidth(), height: collectionView.frame.size.height) + + } +} + +//单项选项中的CollectionView +class ExcellentTVViewCell: UICollectionViewCell,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ + var f_TelevisionId:String! + @IBOutlet weak var inforCollectionView: UICollectionView! + var datatSet:[TVStationSubject] = [] + + + + override func awakeFromNib() { + AppDelegate.instance().httpServer.postExcellentProgram(parameters: ["f_TelevisionId":f_TelevisionId as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData().arrayValue{ + self.datatSet.append(TVStationSubject(json: item)) + } + self.inforCollectionView.reloadData() + }, failHandler: { (error) in + + }) + } + } + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell1", for: indexPath) as! ExcellentTVInforViewCell + return cell + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return datatSet.count + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: (getScreenWidth()-30)/2, height: 150) + } + + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsetsMake(10, 10, 10, 10) + } + +} + +class ExcellentTVInforViewCell: UICollectionViewCell{ + +} + +class TVSubjectInfor{ + var id:String! + var name:String! + var text:String! + var open:Bool! + var ch:[TVSubjectInfor]=[] + init(json:JSON){ + id = json["id"].stringValue + name = json["name"].stringValue + text = json["text"].stringValue + name = json["name"].stringValue + for item in json["children"].arrayValue { + ch.append(TVSubjectInfor(json: item)) + } + } +} diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard index 8cf70ce..74b7138 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard @@ -85,6 +85,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -408,5 +537,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift new file mode 100644 index 0000000..0d6ff79 --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationChannelViewController.swift @@ -0,0 +1,108 @@ +// +// TVStationChannelViewController.swift +// YouerLiveVideo +// +// Created by 左丞 on 2017/5/20. +// Copyright © 2017年 左丞. All rights reserved. +// + +import UIKit + +class TVStationChannelViewController: UIViewController { + + @IBOutlet weak var collectionView: UICollectionView! + var typeList:[String] = ["直播节目","点播"] + override func viewDidLoad() { + super.viewDidLoad() + self.automaticallyAdjustsScrollViewInsets = false + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + func moreBtnClick(send:UIButton){ + + } + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} + +extension TVStationChannelViewController:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) + return cell + } + + func numberOfSections(in collectionView: UICollectionView) -> Int { + return 2 + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 4 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { + return CGSize(width: getScreenWidth(), height: 44) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsetsMake(10, 10, 10, 10) + } + + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: (getScreenWidth()-30)/2, height: 200) + } + + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { + var reusableView:UICollectionReusableView! + if kind == UICollectionElementKindSectionHeader{ + let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "HeaderView", for: indexPath) as! TVStationChannelHeaderView + headerView.title.text = typeList[indexPath.section] + headerView.moreBtn.tag = 100+indexPath.section + headerView.moreBtn.addTarget(self, action: #selector(TVStationChannelViewController.moreBtnClick(send:)), for: .touchUpInside) + headerView.logo.image = UIImage(named: "icon") + reusableView = headerView + } + return reusableView + } + +} + +class TVStationChannelCell: UICollectionViewCell { + + @IBOutlet weak var tvStationLogo: UIImageView! + @IBOutlet weak var tvStationName: UILabel! +} + + +class TVStationChannelHeaderView: UICollectionReusableView { + + + @IBOutlet weak var moreBtn: UIButton! + @IBOutlet weak var logo: UIImageView! + @IBOutlet weak var title: UILabel! + +} + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift index 1d8efb6..7ad8607 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStationViewController.swift @@ -19,6 +19,7 @@ class TVStationViewController: UIViewController { super.viewDidLoad() self.configTheme() getDataList() + self.automaticallyAdjustsScrollViewInsets = false self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .search, target: self, action: #selector(TVStationViewController.pushToSeachViewController)) // Do any additional setup after loading the view. } @@ -147,11 +148,10 @@ extension TVStationViewController:UICollectionViewDelegate,UICollectionViewDeleg func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if collectionView.tag == 3{ - let vc = Story.instantiateViewControllerWithIdentifier("TVStationInforViewControllerVC", storyName: "TVStation") as! TVStationInforViewController - vc.excellentTVStationProgram = excellentTVStationProgram[indexPath.row] + let vc = Story.instantiateViewControllerWithIdentifier("ExcellentTVViewControllerVC", storyName: "TVStation") as! ExcellentTVViewController self.navigationController?.pushViewController(vc, animated: true) }else{ - let vc = Story.instantiateViewControllerWithIdentifier("LiveInforViewControllerVC", storyName: "Resource") as! LiveInforViewController + let vc = Story.instantiateViewControllerWithIdentifier("TVStationChannelViewControllerVC", storyName: "TVStation") as! TVStationChannelViewController self.navigationController?.pushViewController(vc, animated: true) } } -- libgit2 0.21.0