Commit 546f1a6e402a1993e9d88d1b730864fcb378003c
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud
Showing
47 changed files
with
1996 additions
and
178 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -25,9 +25,23 @@ |
| 25 | 25 | 811BB6831E8106A2005C6291 /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 811BB6821E8106A2005C6291 /* CNLivePlayerSDK.framework */; }; |
| 26 | 26 | 811BB6851E8106AF005C6291 /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 811BB6821E8106A2005C6291 /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 27 | 27 | 811BB6881E8107B4005C6291 /* LVCChatViewTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 811BB6871E8107B4005C6291 /* LVCChatViewTableViewCell.m */; }; |
| 28 | - 811BB68B1E8108DB005C6291 /* LVCChatRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 811BB68A1E8108DB005C6291 /* LVCChatRoomModel.m */; }; | |
| 29 | 28 | 811BB68E1E8116C8005C6291 /* NSString+StringSize.m in Sources */ = {isa = PBXBuildFile; fileRef = 811BB68D1E8116C8005C6291 /* NSString+StringSize.m */; }; |
| 29 | + 8130911E1E84C0F0005F0BFF /* LVCMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8130911D1E84C0F0005F0BFF /* LVCMessage.m */; }; | |
| 30 | 30 | 81A1B9A91E8277410079FF5F /* LVCInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A1B9A81E8277410079FF5F /* LVCInputView.m */; }; |
| 31 | + 81A482F51E88ACC80097A80A /* LVCTelevisionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */; }; | |
| 32 | + 81A482F81E88AFA20097A80A /* LVCFirstHeaderReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */; }; | |
| 33 | + 81A483011E88B0130097A80A /* LVCBannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482FE1E88B0130097A80A /* LVCBannerModel.m */; }; | |
| 34 | + 81A483021E88B0130097A80A /* LVCChatRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483001E88B0130097A80A /* LVCChatRoomModel.m */; }; | |
| 35 | + 81A483051E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */; }; | |
| 36 | + 81A483081E88B6140097A80A /* UIView+ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483071E88B6140097A80A /* UIView+ViewController.m */; }; | |
| 37 | + 81A4830B1E88B7EE0097A80A /* LVCOtherHeaderReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4830A1E88B7EE0097A80A /* LVCOtherHeaderReusableView.m */; }; | |
| 38 | + 81A4830E1E88B8300097A80A /* LVCChannelsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4830D1E88B8300097A80A /* LVCChannelsModel.m */; }; | |
| 39 | + 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483101E88B8630097A80A /* LVCChannelDetailsModel.m */; }; | |
| 40 | + 81A483141E88BA420097A80A /* LVCLiveListCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483131E88BA420097A80A /* LVCLiveListCollectionViewCell.m */; }; | |
| 41 | + 81A483171E88BED00097A80A /* LVCTVLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483161E88BED00097A80A /* LVCTVLiveViewController.m */; }; | |
| 42 | + 81A4831A1E88E19C0097A80A /* LVCMoreProgramViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483191E88E19C0097A80A /* LVCMoreProgramViewController.m */; }; | |
| 43 | + 81A4831D1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4831C1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m */; }; | |
| 44 | + 81A483201E88F4BF0097A80A /* LVCProgramModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */; }; | |
| 31 | 45 | 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */; }; |
| 32 | 46 | D2029B861E6EAAA50027CD92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B851E6EAAA50027CD92 /* main.m */; }; |
| 33 | 47 | D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2029B901E6EAAA50027CD92 /* animation.xcassets */; }; |
| ... | ... | @@ -258,12 +272,40 @@ |
| 258 | 272 | 811BB6821E8106A2005C6291 /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; |
| 259 | 273 | 811BB6861E8107B4005C6291 /* LVCChatViewTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChatViewTableViewCell.h; sourceTree = "<group>"; }; |
| 260 | 274 | 811BB6871E8107B4005C6291 /* LVCChatViewTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChatViewTableViewCell.m; sourceTree = "<group>"; }; |
| 261 | - 811BB6891E8108DB005C6291 /* LVCChatRoomModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LVCChatRoomModel.h; path = LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatRoomModel.h; sourceTree = SOURCE_ROOT; }; | |
| 262 | - 811BB68A1E8108DB005C6291 /* LVCChatRoomModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LVCChatRoomModel.m; path = LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatRoomModel.m; sourceTree = SOURCE_ROOT; }; | |
| 263 | 275 | 811BB68C1E8116C8005C6291 /* NSString+StringSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+StringSize.h"; sourceTree = "<group>"; }; |
| 264 | 276 | 811BB68D1E8116C8005C6291 /* NSString+StringSize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+StringSize.m"; sourceTree = "<group>"; }; |
| 277 | + 8130911C1E84C0F0005F0BFF /* LVCMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMessage.h; sourceTree = "<group>"; }; | |
| 278 | + 8130911D1E84C0F0005F0BFF /* LVCMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMessage.m; sourceTree = "<group>"; }; | |
| 265 | 279 | 81A1B9A71E8277410079FF5F /* LVCInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCInputView.h; sourceTree = "<group>"; }; |
| 266 | 280 | 81A1B9A81E8277410079FF5F /* LVCInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCInputView.m; sourceTree = "<group>"; }; |
| 281 | + 81A482F31E88ACC80097A80A /* LVCTelevisionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LVCTelevisionView.h; path = LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.h; sourceTree = SOURCE_ROOT; }; | |
| 282 | + 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LVCTelevisionView.m; path = LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.m; sourceTree = SOURCE_ROOT; }; | |
| 283 | + 81A482F61E88AFA20097A80A /* LVCFirstHeaderReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCFirstHeaderReusableView.h; sourceTree = "<group>"; }; | |
| 284 | + 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCFirstHeaderReusableView.m; sourceTree = "<group>"; }; | |
| 285 | + 81A482FD1E88B0130097A80A /* LVCBannerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCBannerModel.h; sourceTree = "<group>"; }; | |
| 286 | + 81A482FE1E88B0130097A80A /* LVCBannerModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCBannerModel.m; sourceTree = "<group>"; }; | |
| 287 | + 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChatRoomModel.h; sourceTree = "<group>"; }; | |
| 288 | + 81A483001E88B0130097A80A /* LVCChatRoomModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChatRoomModel.m; sourceTree = "<group>"; }; | |
| 289 | + 81A483031E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCHeaderRollCollectionViewCell.h; sourceTree = "<group>"; }; | |
| 290 | + 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCHeaderRollCollectionViewCell.m; sourceTree = "<group>"; }; | |
| 291 | + 81A483061E88B6140097A80A /* UIView+ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+ViewController.h"; sourceTree = "<group>"; }; | |
| 292 | + 81A483071E88B6140097A80A /* UIView+ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+ViewController.m"; sourceTree = "<group>"; }; | |
| 293 | + 81A483091E88B7EE0097A80A /* LVCOtherHeaderReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCOtherHeaderReusableView.h; sourceTree = "<group>"; }; | |
| 294 | + 81A4830A1E88B7EE0097A80A /* LVCOtherHeaderReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCOtherHeaderReusableView.m; sourceTree = "<group>"; }; | |
| 295 | + 81A4830C1E88B8300097A80A /* LVCChannelsModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChannelsModel.h; sourceTree = "<group>"; }; | |
| 296 | + 81A4830D1E88B8300097A80A /* LVCChannelsModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChannelsModel.m; sourceTree = "<group>"; }; | |
| 297 | + 81A4830F1E88B8630097A80A /* LVCChannelDetailsModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChannelDetailsModel.h; sourceTree = "<group>"; }; | |
| 298 | + 81A483101E88B8630097A80A /* LVCChannelDetailsModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChannelDetailsModel.m; sourceTree = "<group>"; }; | |
| 299 | + 81A483121E88BA420097A80A /* LVCLiveListCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveListCollectionViewCell.h; sourceTree = "<group>"; }; | |
| 300 | + 81A483131E88BA420097A80A /* LVCLiveListCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCLiveListCollectionViewCell.m; sourceTree = "<group>"; }; | |
| 301 | + 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTVLiveViewController.h; sourceTree = "<group>"; }; | |
| 302 | + 81A483161E88BED00097A80A /* LVCTVLiveViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTVLiveViewController.m; sourceTree = "<group>"; }; | |
| 303 | + 81A483181E88E19C0097A80A /* LVCMoreProgramViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMoreProgramViewController.h; sourceTree = "<group>"; }; | |
| 304 | + 81A483191E88E19C0097A80A /* LVCMoreProgramViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMoreProgramViewController.m; sourceTree = "<group>"; }; | |
| 305 | + 81A4831B1E88E1EB0097A80A /* LVCMoreSortTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMoreSortTableViewCell.h; sourceTree = "<group>"; }; | |
| 306 | + 81A4831C1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMoreSortTableViewCell.m; sourceTree = "<group>"; }; | |
| 307 | + 81A4831E1E88F4BF0097A80A /* LVCProgramModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCProgramModel.h; sourceTree = "<group>"; }; | |
| 308 | + 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCProgramModel.m; sourceTree = "<group>"; }; | |
| 267 | 309 | 81FB5B3A1E7A6FFC00F98E1D /* SevenSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SevenSwitch.h; sourceTree = "<group>"; }; |
| 268 | 310 | 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SevenSwitch.m; sourceTree = "<group>"; }; |
| 269 | 311 | D2029B811E6EAAA50027CD92 /* LiveVideoCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiveVideoCloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| ... | ... | @@ -652,6 +694,8 @@ |
| 652 | 694 | 81A1B9A81E8277410079FF5F /* LVCInputView.m */, |
| 653 | 695 | 811BB6861E8107B4005C6291 /* LVCChatViewTableViewCell.h */, |
| 654 | 696 | 811BB6871E8107B4005C6291 /* LVCChatViewTableViewCell.m */, |
| 697 | + 8130911C1E84C0F0005F0BFF /* LVCMessage.h */, | |
| 698 | + 8130911D1E84C0F0005F0BFF /* LVCMessage.m */, | |
| 655 | 699 | ); |
| 656 | 700 | name = ChatView; |
| 657 | 701 | path = ../ChatView; |
| ... | ... | @@ -668,6 +712,23 @@ |
| 668 | 712 | path = CNLiveSDK; |
| 669 | 713 | sourceTree = "<group>"; |
| 670 | 714 | }; |
| 715 | + 81A482FC1E88B0130097A80A /* Model */ = { | |
| 716 | + isa = PBXGroup; | |
| 717 | + children = ( | |
| 718 | + 81A482FD1E88B0130097A80A /* LVCBannerModel.h */, | |
| 719 | + 81A482FE1E88B0130097A80A /* LVCBannerModel.m */, | |
| 720 | + 81A4830C1E88B8300097A80A /* LVCChannelsModel.h */, | |
| 721 | + 81A4830D1E88B8300097A80A /* LVCChannelsModel.m */, | |
| 722 | + 81A4830F1E88B8630097A80A /* LVCChannelDetailsModel.h */, | |
| 723 | + 81A483101E88B8630097A80A /* LVCChannelDetailsModel.m */, | |
| 724 | + 81A4831E1E88F4BF0097A80A /* LVCProgramModel.h */, | |
| 725 | + 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */, | |
| 726 | + 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */, | |
| 727 | + 81A483001E88B0130097A80A /* LVCChatRoomModel.m */, | |
| 728 | + ); | |
| 729 | + path = Model; | |
| 730 | + sourceTree = "<group>"; | |
| 731 | + }; | |
| 671 | 732 | 81FB5B391E7A6FFC00F98E1D /* SevenSwitch */ = { |
| 672 | 733 | isa = PBXGroup; |
| 673 | 734 | children = ( |
| ... | ... | @@ -1176,6 +1237,8 @@ |
| 1176 | 1237 | D2029CDD1E6EAE2E0027CD92 /* Category */ = { |
| 1177 | 1238 | isa = PBXGroup; |
| 1178 | 1239 | children = ( |
| 1240 | + 81A483061E88B6140097A80A /* UIView+ViewController.h */, | |
| 1241 | + 81A483071E88B6140097A80A /* UIView+ViewController.m */, | |
| 1179 | 1242 | D24571561E8393EB00AA85D6 /* UIImageView+ZXExtension.h */, |
| 1180 | 1243 | D24571571E8393EB00AA85D6 /* UIImageView+ZXExtension.m */, |
| 1181 | 1244 | 811BB68C1E8116C8005C6291 /* NSString+StringSize.h */, |
| ... | ... | @@ -1539,7 +1602,7 @@ |
| 1539 | 1602 | isa = PBXGroup; |
| 1540 | 1603 | children = ( |
| 1541 | 1604 | D2888DA81E6EC014003A77C8 /* Controller */, |
| 1542 | - D2888DA91E6EC014003A77C8 /* Model */, | |
| 1605 | + 81A482FC1E88B0130097A80A /* Model */, | |
| 1543 | 1606 | D2888DAA1E6EC014003A77C8 /* View */, |
| 1544 | 1607 | ); |
| 1545 | 1608 | path = homeSections; |
| ... | ... | @@ -1556,31 +1619,38 @@ |
| 1556 | 1619 | 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */, |
| 1557 | 1620 | D25BF87E1E7BD266007FB138 /* LVCUGCLivePlayerController.h */, |
| 1558 | 1621 | D25BF87F1E7BD266007FB138 /* LVCUGCLivePlayerController.m */, |
| 1622 | + 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */, | |
| 1623 | + 81A483161E88BED00097A80A /* LVCTVLiveViewController.m */, | |
| 1624 | + 81A483181E88E19C0097A80A /* LVCMoreProgramViewController.h */, | |
| 1625 | + 81A483191E88E19C0097A80A /* LVCMoreProgramViewController.m */, | |
| 1559 | 1626 | ); |
| 1560 | 1627 | path = Controller; |
| 1561 | 1628 | sourceTree = "<group>"; |
| 1562 | 1629 | }; |
| 1563 | - D2888DA91E6EC014003A77C8 /* Model */ = { | |
| 1564 | - isa = PBXGroup; | |
| 1565 | - children = ( | |
| 1566 | - 811BB6891E8108DB005C6291 /* LVCChatRoomModel.h */, | |
| 1567 | - 811BB68A1E8108DB005C6291 /* LVCChatRoomModel.m */, | |
| 1568 | - ); | |
| 1569 | - path = Model; | |
| 1570 | - sourceTree = "<group>"; | |
| 1571 | - }; | |
| 1572 | 1630 | D2888DAA1E6EC014003A77C8 /* View */ = { |
| 1573 | 1631 | isa = PBXGroup; |
| 1574 | 1632 | children = ( |
| 1575 | 1633 | 811BB67B1E80F858005C6291 /* ChatView */, |
| 1576 | 1634 | 810B64DE1E779AE900133E15 /* LVCPlayer.h */, |
| 1577 | 1635 | 810B64DF1E779AE900133E15 /* LVCPlayer.m */, |
| 1636 | + 81A482F31E88ACC80097A80A /* LVCTelevisionView.h */, | |
| 1637 | + 81A482F41E88ACC80097A80A /* LVCTelevisionView.m */, | |
| 1638 | + 81A482F61E88AFA20097A80A /* LVCFirstHeaderReusableView.h */, | |
| 1639 | + 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */, | |
| 1640 | + 81A483091E88B7EE0097A80A /* LVCOtherHeaderReusableView.h */, | |
| 1641 | + 81A4830A1E88B7EE0097A80A /* LVCOtherHeaderReusableView.m */, | |
| 1642 | + 81A483121E88BA420097A80A /* LVCLiveListCollectionViewCell.h */, | |
| 1643 | + 81A483131E88BA420097A80A /* LVCLiveListCollectionViewCell.m */, | |
| 1644 | + 81A483031E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.h */, | |
| 1645 | + 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */, | |
| 1578 | 1646 | 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */, |
| 1579 | 1647 | 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */, |
| 1580 | 1648 | D25BF8811E7F775F007FB138 /* LVCUGCPlayerLoadingView.h */, |
| 1581 | 1649 | D25BF8821E7F775F007FB138 /* LVCUGCPlayerLoadingView.m */, |
| 1582 | 1650 | D25BF8911E7FBAEA007FB138 /* LVCUGCBackgroundView.h */, |
| 1583 | 1651 | D25BF8921E7FBAEA007FB138 /* LVCUGCBackgroundView.m */, |
| 1652 | + 81A4831B1E88E1EB0097A80A /* LVCMoreSortTableViewCell.h */, | |
| 1653 | + 81A4831C1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m */, | |
| 1584 | 1654 | ); |
| 1585 | 1655 | path = View; |
| 1586 | 1656 | sourceTree = "<group>"; |
| ... | ... | @@ -1782,6 +1852,7 @@ |
| 1782 | 1852 | D22830FF1E77C69E00627701 /* GiftListView.m in Sources */, |
| 1783 | 1853 | D2029CC01E6EADE10027CD92 /* UIImage+GIF.m in Sources */, |
| 1784 | 1854 | D25BF8831E7F775F007FB138 /* LVCUGCPlayerLoadingView.m in Sources */, |
| 1855 | + 81A4831A1E88E19C0097A80A /* LVCMoreProgramViewController.m in Sources */, | |
| 1785 | 1856 | D2029BCF1E6EADD70027CD92 /* ZXTabBarController.m in Sources */, |
| 1786 | 1857 | D2029D071E6EAE2E0027CD92 /* ZXConst.m in Sources */, |
| 1787 | 1858 | D2029CB81E6EADE10027CD92 /* SDImageCache.m in Sources */, |
| ... | ... | @@ -1794,16 +1865,19 @@ |
| 1794 | 1865 | D2029CA01E6EADE10027CD92 /* NSObject+MJProperty.m in Sources */, |
| 1795 | 1866 | D2029CB51E6EADE10027CD92 /* SDiOSVersion.m in Sources */, |
| 1796 | 1867 | D2029C9C1E6EADE10027CD92 /* MJPropertyType.m in Sources */, |
| 1868 | + 81A4830E1E88B8300097A80A /* LVCChannelsModel.m in Sources */, | |
| 1797 | 1869 | D22831091E77D8D500627701 /* GiftModel.m in Sources */, |
| 1798 | 1870 | D2029CCD1E6EADE10027CD92 /* SearchModel.m in Sources */, |
| 1799 | 1871 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, |
| 1800 | 1872 | D2029CCB1E6EADE10027CD92 /* SVRadialGradientLayer.m in Sources */, |
| 1873 | + 8130911E1E84C0F0005F0BFF /* LVCMessage.m in Sources */, | |
| 1801 | 1874 | D23696841E7FC6A900E4BF71 /* chatListCell.m in Sources */, |
| 1802 | 1875 | D2029CAF1E6EADE10027CD92 /* MJRefreshStateHeader.m in Sources */, |
| 1803 | 1876 | D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */, |
| 1804 | 1877 | D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */, |
| 1805 | 1878 | D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */, |
| 1806 | 1879 | D2029C8D1E6EADE10027CD92 /* AFAutoPurgingImageCache.m in Sources */, |
| 1880 | + 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */, | |
| 1807 | 1881 | D2029D011E6EAE2E0027CD92 /* UIColor+HexString.m in Sources */, |
| 1808 | 1882 | D2029CA41E6EADE10027CD92 /* MJRefreshComponent.m in Sources */, |
| 1809 | 1883 | D2575C7A1E76A4F300E3A8FC /* NHCarViews.m in Sources */, |
| ... | ... | @@ -1833,14 +1907,17 @@ |
| 1833 | 1907 | D2029C8F1E6EADE10027CD92 /* AFNetworkActivityIndicatorManager.m in Sources */, |
| 1834 | 1908 | 810B65031E779B1F00133E15 /* MASViewConstraint.m in Sources */, |
| 1835 | 1909 | D2029BCE1E6EADD70027CD92 /* ZXNavigationController.m in Sources */, |
| 1910 | + 81A482F51E88ACC80097A80A /* LVCTelevisionView.m in Sources */, | |
| 1836 | 1911 | D2029CA21E6EADE10027CD92 /* MJRefreshAutoFooter.m in Sources */, |
| 1837 | 1912 | D2029CC71E6EADE10027CD92 /* SVIndefiniteAnimatedView.m in Sources */, |
| 1838 | 1913 | D2029CA31E6EADE10027CD92 /* MJRefreshBackFooter.m in Sources */, |
| 1839 | 1914 | D255300C1E793F8200DF38A5 /* NHFighterView+animDelegagte.m in Sources */, |
| 1915 | + 81A4831D1E88E1EB0097A80A /* LVCMoreSortTableViewCell.m in Sources */, | |
| 1840 | 1916 | D2575C4A1E7685DE00E3A8FC /* UIView+Bubbling.m in Sources */, |
| 1841 | 1917 | D2029CA61E6EADE10027CD92 /* MJRefreshHeader.m in Sources */, |
| 1842 | 1918 | D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */, |
| 1843 | 1919 | D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */, |
| 1920 | + 81A483081E88B6140097A80A /* UIView+ViewController.m in Sources */, | |
| 1844 | 1921 | D2029CC81E6EADE10027CD92 /* SVProgressAnimatedView.m in Sources */, |
| 1845 | 1922 | D2029C961E6EADE10027CD92 /* MBProgressHUD.m in Sources */, |
| 1846 | 1923 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */, |
| ... | ... | @@ -1849,7 +1926,6 @@ |
| 1849 | 1926 | D2029CB61E6EADE10027CD92 /* MKAnnotationView+WebCache.m in Sources */, |
| 1850 | 1927 | 810B64FE1E779B1F00133E15 /* MASCompositeConstraint.m in Sources */, |
| 1851 | 1928 | D2029C981E6EADE10027CD92 /* MJExtensionConst.m in Sources */, |
| 1852 | - 811BB68B1E8108DB005C6291 /* LVCChatRoomModel.m in Sources */, | |
| 1853 | 1929 | D2575C671E76A25400E3A8FC /* LVCInteractionController.m in Sources */, |
| 1854 | 1930 | D2029CAE1E6EADE10027CD92 /* MJRefreshNormalHeader.m in Sources */, |
| 1855 | 1931 | D23696921E7FC83800E4BF71 /* chatMsgModel.m in Sources */, |
| ... | ... | @@ -1860,36 +1936,44 @@ |
| 1860 | 1936 | D2029C921E6EADE10027CD92 /* UIImageView+AFNetworking.m in Sources */, |
| 1861 | 1937 | D224B1971E826ED800CC61D0 /* ChatBarrageAnimAction.m in Sources */, |
| 1862 | 1938 | D2029C9E1E6EADE10027CD92 /* NSObject+MJCoding.m in Sources */, |
| 1939 | + 81A483021E88B0130097A80A /* LVCChatRoomModel.m in Sources */, | |
| 1863 | 1940 | D2029C991E6EADE10027CD92 /* MJFoundation.m in Sources */, |
| 1864 | 1941 | D2575C461E76857100E3A8FC /* LVCAnimationManager.m in Sources */, |
| 1865 | 1942 | D2029C8A1E6EADE10027CD92 /* AFURLRequestSerialization.m in Sources */, |
| 1866 | 1943 | D2029D041E6EAE2E0027CD92 /* UILabel+ContentSize.m in Sources */, |
| 1867 | 1944 | D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */, |
| 1868 | 1945 | D2029C871E6EADE10027CD92 /* AFHTTPSessionManager.m in Sources */, |
| 1946 | + D236968D1E7FC7C200E4BF71 /* CNBarrageManager.m in Sources */, | |
| 1947 | + 81A482F81E88AFA20097A80A /* LVCFirstHeaderReusableView.m in Sources */, | |
| 1869 | 1948 | D2029B861E6EAAA50027CD92 /* main.m in Sources */, |
| 1870 | 1949 | D2029C8C1E6EADE10027CD92 /* AFURLSessionManager.m in Sources */, |
| 1871 | 1950 | D2029C9F1E6EADE10027CD92 /* NSObject+MJKeyValue.m in Sources */, |
| 1872 | 1951 | D25BF8A01E80C4BD007FB138 /* UIImage+LVCVagueImage.m in Sources */, |
| 1873 | 1952 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */, |
| 1953 | + 81A483011E88B0130097A80A /* LVCBannerModel.m in Sources */, | |
| 1874 | 1954 | 810B65021E779B1F00133E15 /* MASViewAttribute.m in Sources */, |
| 1875 | 1955 | D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */, |
| 1876 | 1956 | D2029CAC1E6EADE10027CD92 /* MJRefreshBackStateFooter.m in Sources */, |
| 1877 | 1957 | D2029CB11E6EADE10027CD92 /* MJRefreshConst.m in Sources */, |
| 1878 | 1958 | D2029CAD1E6EADE10027CD92 /* MJRefreshGifHeader.m in Sources */, |
| 1959 | + 81A483141E88BA420097A80A /* LVCLiveListCollectionViewCell.m in Sources */, | |
| 1879 | 1960 | D2029CB31E6EADE10027CD92 /* UIScrollView+MJRefresh.m in Sources */, |
| 1880 | 1961 | D2029D051E6EAE2E0027CD92 /* UILabel+labelFitSize.m in Sources */, |
| 1881 | 1962 | D2029CB21E6EADE10027CD92 /* UIScrollView+MJExtension.m in Sources */, |
| 1882 | 1963 | D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */, |
| 1883 | 1964 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */, |
| 1884 | 1965 | D2029C8E1E6EADE10027CD92 /* AFImageDownloader.m in Sources */, |
| 1966 | + 81A483201E88F4BF0097A80A /* LVCProgramModel.m in Sources */, | |
| 1885 | 1967 | D2029BCA1E6EADD70027CD92 /* BaseModel.m in Sources */, |
| 1886 | 1968 | D25BF87B1E7B8A82007FB138 /* SliderView.m in Sources */, |
| 1887 | 1969 | 810B65041E779B1F00133E15 /* NSArray+MASAdditions.m in Sources */, |
| 1970 | + 81A4830B1E88B7EE0097A80A /* LVCOtherHeaderReusableView.m in Sources */, | |
| 1888 | 1971 | D25BF8801E7BD266007FB138 /* LVCUGCLivePlayerController.m in Sources */, |
| 1889 | 1972 | D2029D031E6EAE2E0027CD92 /* UIImage+ZXExtension.m in Sources */, |
| 1890 | 1973 | D24571581E8393EB00AA85D6 /* UIImageView+ZXExtension.m in Sources */, |
| 1891 | 1974 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */, |
| 1892 | 1975 | D2029CCA1E6EADE10027CD92 /* SVProgressHUD.m in Sources */, |
| 1976 | + 81A483051E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m in Sources */, | |
| 1893 | 1977 | D2029CA81E6EADE10027CD92 /* MJRefreshAutoNormalFooter.m in Sources */, |
| 1894 | 1978 | D2029C891E6EADE10027CD92 /* AFSecurityPolicy.m in Sources */, |
| 1895 | 1979 | D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */, |
| ... | ... | @@ -1929,6 +2013,7 @@ |
| 1929 | 2013 | D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */, |
| 1930 | 2014 | D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */, |
| 1931 | 2015 | D25530061E7911A800DF38A5 /* GiftAnimationAction.m in Sources */, |
| 2016 | + 81A483171E88BED00097A80A /* LVCTVLiveViewController.m in Sources */, | |
| 1932 | 2017 | 81A1B9A91E8277410079FF5F /* LVCInputView.m in Sources */, |
| 1933 | 2018 | D2029CD41E6EADE70027CD92 /* HttpService.m in Sources */, |
| 1934 | 2019 | ); | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.h
| ... | ... | @@ -9,7 +9,11 @@ |
| 9 | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | |
| 11 | 11 | @interface LVCChatView : UIView |
| 12 | +@property (nonatomic, strong) UITableView *tableView; | |
| 12 | 13 | |
| 13 | 14 | - (instancetype)initWithFrame:(CGRect)frame roomId:(NSString *)roomId; |
| 14 | 15 | |
| 16 | +- (void)sendMsgWithMessage:(NSString *)message; | |
| 17 | + | |
| 18 | + | |
| 15 | 19 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.m
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #import "LVCChatRoomModel.h" |
| 12 | 12 | #import "UILabel+ContentSize.h" |
| 13 | 13 | #import "NSString+StringSize.h" |
| 14 | +#import "LVCMessage.h" | |
| 14 | 15 | |
| 15 | 16 | @interface LVCChatView ()<CNLiveChatManagerDelegate,UITableViewDelegate,UITableViewDataSource> |
| 16 | 17 | { |
| ... | ... | @@ -18,7 +19,7 @@ |
| 18 | 19 | NSMutableArray *_chatDataArr; |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | -@property (nonatomic, strong) UITableView *tableView; | |
| 22 | + | |
| 22 | 23 | @property (nonatomic, strong) UILabel *chatLab; |
| 23 | 24 | @property (nonatomic, strong) NSMutableArray *messageHeight; |
| 24 | 25 | |
| ... | ... | @@ -31,10 +32,11 @@ |
| 31 | 32 | self = [super initWithFrame:frame]; |
| 32 | 33 | if (self) { |
| 33 | 34 | |
| 35 | + _roomId = roomId; | |
| 36 | + | |
| 34 | 37 | self.backgroundColor = [UIColor whiteColor]; |
| 35 | 38 | _chatDataArr = [NSMutableArray new]; |
| 36 | 39 | _messageHeight = [NSMutableArray new]; |
| 37 | - [self addData]; | |
| 38 | 40 | |
| 39 | 41 | [self addSubview:self.tableView]; |
| 40 | 42 | [self addSubview:self.chatLab]; |
| ... | ... | @@ -44,26 +46,19 @@ |
| 44 | 46 | return self; |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | -- (void)addData | |
| 49 | +- (void)addData:(LVCMessage *)msg | |
| 48 | 50 | { |
| 49 | - for (int i = 0; i < 8; i ++) { | |
| 50 | - LVCChatRoomModel *model = [[LVCChatRoomModel alloc] init]; | |
| 51 | - model.nikeName = @"zzllzz"; | |
| 52 | - model.isReceive = NO; | |
| 53 | - model.message = @"我有一只😁啦啡哦我"; | |
| 54 | - [_chatDataArr addObject:model]; | |
| 55 | - [self cellMessageLabelHeightWithModel:model]; | |
| 56 | - } | |
| 57 | - | |
| 51 | + [_chatDataArr addObject:msg]; | |
| 58 | 52 | [_tableView reloadData]; |
| 53 | + [self scrollToBottom]; | |
| 59 | 54 | } |
| 60 | 55 | |
| 61 | 56 | - (void)joinChatRoomWithRoomId:(NSString *)roomId |
| 62 | 57 | { |
| 63 | - [[CNLiveChatManager sharedCNLiveChatManager] joinExistChatRoom:roomId messageCount:10 success:^(NSString *targetId) { | |
| 64 | - NSLog(@"电视台--加入聊天室---success-%@",targetId); | |
| 58 | + [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:roomId messageCount:10 success:^(NSString *targetId) { | |
| 59 | + NSLog(@"电视台--加入聊天室---success-(%@)",targetId); | |
| 65 | 60 | } error:^(CNLiveChatErrorCode errors, NSString *targetId) { |
| 66 | - NSLog(@"电视台--加入聊天室---failed -%ld",(long)errors); | |
| 61 | + NSLog(@"电视台--加入聊天室---failed -(%ld)",(long)errors); | |
| 67 | 62 | }]; |
| 68 | 63 | |
| 69 | 64 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; |
| ... | ... | @@ -74,10 +69,16 @@ |
| 74 | 69 | { |
| 75 | 70 | [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_CHATROOM targetId:_roomId success:^(CNLiveChatMessage *message) { |
| 76 | 71 | |
| 77 | - NSLog(@"电视台--发送消息---success-%@",message); | |
| 72 | + LVCMessage *msg = [LVCMessage messageWihtContent:message isRight:YES]; | |
| 73 | + | |
| 74 | + dispatch_sync(dispatch_get_main_queue(), ^{ | |
| 75 | + [self addData:msg]; | |
| 76 | + }); | |
| 77 | + | |
| 78 | + NSLog(@"电视台--发送消息---success-(%@)",msg.content); | |
| 78 | 79 | |
| 79 | 80 | } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { |
| 80 | - NSLog(@"电视台--发送消息---failed-%ld",(long)errors); | |
| 81 | + NSLog(@"电视台--发送消息---failed-(%ld)",(long)errors); | |
| 81 | 82 | }]; |
| 82 | 83 | } |
| 83 | 84 | |
| ... | ... | @@ -96,6 +97,20 @@ |
| 96 | 97 | - (void)onReceived:(CNLiveChatMessage *)message |
| 97 | 98 | { |
| 98 | 99 | //接收消息 |
| 100 | + dispatch_queue_t globalQueue=dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
| 101 | + dispatch_async(globalQueue, ^{ | |
| 102 | + LVCMessage *msg = [LVCMessage messageWihtContent:message isRight:NO]; | |
| 103 | + dispatch_sync(dispatch_get_main_queue(), ^{ | |
| 104 | + [self addData:msg]; | |
| 105 | + }); | |
| 106 | + }); | |
| 107 | +} | |
| 108 | + | |
| 109 | +- (void)scrollToBottom { //滚到下方 | |
| 110 | + NSUInteger rowCount = _chatDataArr.count; | |
| 111 | + NSIndexPath* indexPath = [NSIndexPath indexPathForRow:rowCount-1 inSection:0]; | |
| 112 | + [_tableView scrollToRowAtIndexPath:indexPath | |
| 113 | + atScrollPosition:UITableViewScrollPositionBottom animated:NO]; | |
| 99 | 114 | } |
| 100 | 115 | |
| 101 | 116 | #pragma mark - |
| ... | ... | @@ -113,33 +128,17 @@ |
| 113 | 128 | cell = [[LVCChatViewTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; |
| 114 | 129 | } |
| 115 | 130 | |
| 116 | - LVCChatRoomModel *model = _chatDataArr[indexPath.row]; | |
| 117 | - cell.model = model; | |
| 131 | + LVCMessage *message = _chatDataArr[indexPath.row]; | |
| 132 | + cell.message = message; | |
| 118 | 133 | |
| 119 | 134 | return cell; |
| 120 | 135 | } |
| 121 | 136 | |
| 122 | 137 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath |
| 123 | 138 | { |
| 124 | - LVCChatRoomModel *model = [_chatDataArr objectAtIndex:indexPath.row]; | |
| 125 | - | |
| 126 | - return [LVCChatViewTableViewCell getCellHeight:model filterName:model.nikeName height:[_messageHeight objectAtIndex:indexPath.row]]; | |
| 127 | -} | |
| 128 | - | |
| 129 | -- (void)cellMessageLabelHeightWithModel:(LVCChatRoomModel *)model { | |
| 139 | + LVCMessage *message = _chatDataArr[indexPath.row]; | |
| 140 | + return message.cellHeight; | |
| 130 | 141 | |
| 131 | - UILabel *messageLabel = [[UILabel alloc]init]; | |
| 132 | - messageLabel.text = model.message; | |
| 133 | - | |
| 134 | - messageLabel.width = [messageLabel contentWidth].width; | |
| 135 | - | |
| 136 | - if ((SCREEN_WIDTH - messageLabel.width - 85) < 0) { // 多行 | |
| 137 | - CGSize statusLabelSize = [messageLabel.text sizeWithLabelWidth:SCREEN_WIDTH - 85 font:[UIFont systemFontOfSize:14]]; | |
| 138 | - [_messageHeight addObject:@(statusLabelSize.height)]; | |
| 139 | - } else { // 单行 | |
| 140 | - CGSize statusLabelSize = [messageLabel.text sizeWithLabelWidth:messageLabel.width font:[UIFont systemFontOfSize:14]]; | |
| 141 | - [_messageHeight addObject:@(statusLabelSize.height)]; | |
| 142 | - } | |
| 143 | 142 | } |
| 144 | 143 | |
| 145 | 144 | #pragma mark - | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatViewTableViewCell.h
| ... | ... | @@ -7,13 +7,10 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import <UIKit/UIKit.h> |
| 10 | -#import "LVCChatRoomModel.h" | |
| 10 | +#import "LVCMessage.h" | |
| 11 | 11 | |
| 12 | 12 | @interface LVCChatViewTableViewCell : UITableViewCell |
| 13 | 13 | |
| 14 | -@property (nonatomic, strong) LVCChatRoomModel *model; //聊天室model | |
| 15 | - | |
| 16 | -+ (CGFloat)getCellHeight:(LVCChatRoomModel *)message filterName:(NSString *)filterName height:(NSNumber *)height; | |
| 17 | - | |
| 14 | +@property (nonatomic, strong) LVCMessage *message; | |
| 18 | 15 | |
| 19 | 16 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatViewTableViewCell.m
| ... | ... | @@ -42,104 +42,44 @@ |
| 42 | 42 | return self; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -- (void)setModel:(LVCChatRoomModel *)model | |
| 45 | +- (void)setMessage:(LVCMessage *)message | |
| 46 | 46 | { |
| 47 | - if (!model || ![model isKindOfClass:[LVCChatRoomModel class]]) { | |
| 48 | - return; | |
| 49 | - } | |
| 50 | - | |
| 51 | - _model = model; | |
| 52 | - | |
| 53 | - self.messageLab.text = model.message; | |
| 54 | - self.nickNameLab.text = model.nikeName; | |
| 55 | - if (model.isReceive) { //收到的消息 | |
| 56 | - | |
| 57 | - UIImage *bgImage = [UIImage imageNamed:@"Gift box"]; | |
| 58 | - bgImage = [bgImage stretchableImageWithLeftCapWidth:0 topCapHeight:50]; | |
| 59 | - self.bgImageView.image = bgImage; | |
| 60 | - | |
| 61 | - self.nickNameLab.hidden = NO; | |
| 62 | - self.lineLab.hidden = NO; | |
| 63 | - self.iconImageView.frame = CGRectMake(10,10,HEAD_SIZE,HEAD_SIZE); | |
| 64 | - self.nickNameLab.frame = CGRectMake(13,2.5,200,20); | |
| 65 | - | |
| 66 | - self.messageLab.width = [self.messageLab contentWidth].width; | |
| 67 | - | |
| 68 | - //多行 | |
| 69 | - if ((SCREEN_WIDTH - self.messageLab.width - 85) < 0) { | |
| 70 | - CGSize statusLabelSize = [self.messageLab.text sizeWithLabelWidth:SCREEN_WIDTH - 85 font:[UIFont systemFontOfSize:14]]; | |
| 71 | - self.bgImageView.frame = CGRectMake(60, 7.5, SCREEN_WIDTH - 70, statusLabelSize.height + 35); | |
| 72 | - self.messageLab.frame = CGRectMake(13, 27.5, SCREEN_WIDTH - 80, statusLabelSize.height); | |
| 73 | - self.lineLab.width = self.bgImageView.width - 20; | |
| 74 | - | |
| 75 | - } else { //单行 | |
| 76 | - | |
| 77 | - CGSize statusLabelSize = [self.messageLab.text sizeWithLabelWidth:self.messageLab.width font:[UIFont systemFontOfSize:14]]; | |
| 78 | - | |
| 79 | - self.nickNameLab.width = [self.nickNameLab contentWidth].width; | |
| 80 | - if (self.nickNameLab.width > self.messageLab.width) { | |
| 81 | - self.bgImageView.frame = CGRectMake(60, 7.5, self.nickNameLab.width + 20, statusLabelSize.height + 35); | |
| 82 | - self.lineLab.width = self.nickNameLab.width + 5; | |
| 83 | - } else { | |
| 84 | - self.bgImageView.frame = CGRectMake(60, 7.5, self.messageLab.width + 20, statusLabelSize.height + 35); | |
| 85 | - self.lineLab.width = self.messageLab.width + 5; | |
| 86 | - } | |
| 87 | - self.messageLab.frame = CGRectMake(13, 27.5, self.messageLab.width, statusLabelSize.height); | |
| 88 | - } | |
| 89 | - | |
| 90 | - | |
| 91 | - } else { //我的消息 | |
| 92 | - | |
| 47 | + if (message.isRight) { //我的消息 | |
| 93 | 48 | UIImage *bgImage = [UIImage imageNamed:@"Gift box right"]; |
| 94 | 49 | bgImage = [bgImage stretchableImageWithLeftCapWidth:10 topCapHeight:27]; |
| 95 | - self.bgImageView.image = bgImage; | |
| 96 | - self.nickNameLab.hidden = YES; | |
| 97 | - self.lineLab.hidden = YES; | |
| 98 | - self.iconImageView.frame = CGRectMake(SCREEN_WIDTH - 50,6,40,40); | |
| 50 | + _bgImageView.image = bgImage; | |
| 51 | + _bgImageView.frame = message.popFrame; | |
| 52 | + _messageLab.text = message.content; | |
| 53 | + _messageLab.frame = message.contentFrame; | |
| 54 | + _nickNameLab.frame = message.nikenameFrame; | |
| 55 | + _iconImageView.frame = message.portraitsFrame; | |
| 56 | + [_iconImageView sd_setImageWithURL:[NSURL URLWithString:message.portraits] placeholderImage:[UIImage imageNamed:@"touxiang"]]; | |
| 57 | + _lineLab.hidden = YES; | |
| 58 | + | |
| 59 | + } else { //收到的消息 | |
| 99 | 60 | |
| 100 | - self.messageLab.width = [self.messageLab contentWidth].width; | |
| 101 | - | |
| 102 | - if ((SCREEN_WIDTH - self.messageLab.width - 85) < 0) { // 多行 | |
| 103 | - CGSize statusLabelSize = [self.messageLab.text sizeWithLabelWidth:SCREEN_WIDTH - 85 font:[UIFont systemFontOfSize:14]]; | |
| 104 | - | |
| 105 | - self.bgImageView.frame = CGRectMake(10, 7.5, SCREEN_WIDTH - 65, statusLabelSize.height + 20); | |
| 106 | - | |
| 107 | - self.messageLab.frame = CGRectMake(10, 10, SCREEN_WIDTH - 85, statusLabelSize.height); | |
| 108 | - | |
| 109 | - } else { // 单行 | |
| 110 | - CGSize statusLabelSize = [self.messageLab.text sizeWithLabelWidth:self.messageLab.width font:[UIFont systemFontOfSize:14]]; | |
| 111 | - self.bgImageView.frame = CGRectMake(SCREEN_WIDTH - self.messageLab.width - 75, 7.5, self.messageLab.width + 20, statusLabelSize.height + 20); | |
| 112 | - self.messageLab.frame = CGRectMake(8, 10, self.messageLab.width, statusLabelSize.height); | |
| 113 | - } | |
| 114 | - | |
| 61 | + UIImage *bgImage = [UIImage imageNamed:@"Gift box"]; | |
| 62 | + bgImage = [bgImage stretchableImageWithLeftCapWidth:10 topCapHeight:27]; | |
| 63 | + _bgImageView.image = bgImage; | |
| 64 | + _bgImageView.frame = message.popFrame; | |
| 65 | + _nickNameLab.text = message.nikename; | |
| 66 | + _nickNameLab.frame = message.nikenameFrame; | |
| 67 | + _lineLab.frame = message.lineFrame; | |
| 68 | + _lineLab.hidden = NO; | |
| 69 | + [_iconImageView sd_setImageWithURL:[NSURL URLWithString:message.portraits] placeholderImage:[UIImage imageNamed:@"touxiang"]]; | |
| 70 | + _iconImageView.frame = message.portraitsFrame; | |
| 71 | + _messageLab.text = message.content; | |
| 72 | + _messageLab.frame = message.contentFrame; | |
| 115 | 73 | |
| 116 | 74 | } |
| 117 | 75 | } |
| 118 | 76 | |
| 119 | -#pragma mark - action | |
| 120 | -+ (CGFloat)getCellHeight:(LVCChatRoomModel *)message filterName:(NSString *)filterName height:(NSNumber *)height | |
| 121 | -{ | |
| 122 | - if (!message) { | |
| 123 | - return 0; | |
| 124 | - } | |
| 125 | - | |
| 126 | - CGFloat height1 = [height floatValue]; | |
| 127 | - | |
| 128 | - if ([message.nikeName isEqualToString:filterName]) { | |
| 129 | - return height1 + 20 + 15; | |
| 130 | - } else { | |
| 131 | - return height1 + 20 + 15 + 40; | |
| 132 | - } | |
| 133 | -} | |
| 134 | - | |
| 135 | - | |
| 136 | 77 | #pragma mark - |
| 137 | 78 | #pragma mark - getter |
| 138 | 79 | - (UIImageView *)iconImageView |
| 139 | 80 | { |
| 140 | 81 | if (!_iconImageView) { |
| 141 | - _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, HEAD_SIZE, HEAD_SIZE)]; | |
| 142 | - _iconImageView.image = [UIImage imageNamed:@"touxiang"]; | |
| 82 | + _iconImageView = [[UIImageView alloc] init]; | |
| 143 | 83 | } |
| 144 | 84 | return _iconImageView; |
| 145 | 85 | } |
| ... | ... | @@ -147,7 +87,7 @@ |
| 147 | 87 | - (UIImageView *)bgImageView |
| 148 | 88 | { |
| 149 | 89 | if (!_bgImageView) { |
| 150 | - _bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; | |
| 90 | + _bgImageView = [[UIImageView alloc] init]; | |
| 151 | 91 | } |
| 152 | 92 | return _bgImageView; |
| 153 | 93 | } |
| ... | ... | @@ -155,7 +95,7 @@ |
| 155 | 95 | - (UILabel *)lineLab |
| 156 | 96 | { |
| 157 | 97 | if (!_lineLab) { |
| 158 | - _lineLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 23.5, 80, 0.5)]; | |
| 98 | + _lineLab = [[UILabel alloc] init]; | |
| 159 | 99 | _lineLab.backgroundColor = [UIColor colorWithHexString:@"#5a5b5b"]; |
| 160 | 100 | } |
| 161 | 101 | return _lineLab; |
| ... | ... | @@ -164,10 +104,9 @@ |
| 164 | 104 | - (UILabel *)nickNameLab |
| 165 | 105 | { |
| 166 | 106 | if (!_nickNameLab) { |
| 167 | - _nickNameLab = [[UILabel alloc] initWithFrame:CGRectMake(13,2.5,200,20)]; | |
| 107 | + _nickNameLab = [[UILabel alloc] init]; | |
| 168 | 108 | _nickNameLab.font = [UIFont systemFontOfSize:10]; |
| 169 | 109 | _nickNameLab.textColor = [UIColor colorWithHexString:@"#5a5b5b"]; |
| 170 | - _nickNameLab.text = @"zzll"; | |
| 171 | 110 | } |
| 172 | 111 | return _nickNameLab; |
| 173 | 112 | } |
| ... | ... | @@ -175,10 +114,9 @@ |
| 175 | 114 | - (UILabel *)messageLab |
| 176 | 115 | { |
| 177 | 116 | if (!_messageLab) { |
| 178 | - _messageLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 25, SCREEN_WIDTH - 85, 30)]; | |
| 117 | + _messageLab = [[UILabel alloc] init]; | |
| 179 | 118 | _messageLab.textColor = [UIColor whiteColor]; |
| 180 | 119 | _messageLab.font = [UIFont systemFontOfSize:14]; |
| 181 | - _messageLab.text = @"哈哈哈哈"; | |
| 182 | 120 | _messageLab.numberOfLines = 0; |
| 183 | 121 | } |
| 184 | 122 | return _messageLab; | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCInputView.h
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCInputView.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCMessage.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCMessage.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/24. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +@interface LVCMessage : NSObject | |
| 12 | + | |
| 13 | +@property (nonatomic, strong, readonly) NSString *nikename; //昵称 | |
| 14 | +@property (nonatomic, strong, readonly) NSString *portraits; //头像 | |
| 15 | +@property (nonatomic, strong, readonly) NSString *content; //消息内容 | |
| 16 | + | |
| 17 | +@property (nonatomic, assign, readonly) CGRect nikenameFrame; //昵称frame | |
| 18 | +@property (nonatomic, assign, readonly) CGRect contentFrame; //内容frame | |
| 19 | +@property (nonatomic, assign, readonly) CGRect popFrame; //气泡frame | |
| 20 | +@property (nonatomic, assign, readonly) CGRect portraitsFrame; //头像frame | |
| 21 | +@property (nonatomic, assign, readonly) CGRect lineFrame; //分割线frame | |
| 22 | +@property (nonatomic, assign, readonly) CGFloat cellHeight; //cell高 | |
| 23 | + | |
| 24 | +@property (nonatomic, assign, readonly) BOOL isRight; //是否是接收者 | |
| 25 | + | |
| 26 | + | |
| 27 | +//构造消息对象 -- 消息文本 | |
| 28 | ++ (instancetype)messageWihtContent:(CNLiveChatMessage *)content isRight:(BOOL)isRight; | |
| 29 | + | |
| 30 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCMessage.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCMessage.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/24. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCMessage.h" | |
| 10 | + | |
| 11 | +#define ICON_WIDTH 35.0 //头像大小 | |
| 12 | +#define ICON_TOP_SPACE 8.0 //头像与cell间距 | |
| 13 | +#define POP_TOP_SPACE 10 //pop与cell间距 | |
| 14 | + | |
| 15 | +@interface LVCMessage () | |
| 16 | + | |
| 17 | +@property (nonatomic, strong) NSString *nikename; //昵称 | |
| 18 | +@property (nonatomic, strong) NSString *portraits; //头像 | |
| 19 | +@property (nonatomic, strong) NSString *content; //消息内容 | |
| 20 | + | |
| 21 | +@property (nonatomic, assign) CGRect nikenameFrame; //昵称frame | |
| 22 | +@property (nonatomic, assign) CGRect contentFrame; //内容frame | |
| 23 | +@property (nonatomic, assign) CGRect popFrame; //气泡frame | |
| 24 | +@property (nonatomic, assign) CGRect portraitsFrame; //头像frame | |
| 25 | +@property (nonatomic, assign) CGRect lineFrame; //分割线frame | |
| 26 | +@property (nonatomic, assign) CGFloat cellHeight; //cell高 | |
| 27 | + | |
| 28 | +@property (nonatomic, assign) BOOL isRight; //是否是接收者(YES:我的消息) | |
| 29 | + | |
| 30 | +@end | |
| 31 | + | |
| 32 | +@implementation LVCMessage | |
| 33 | + | |
| 34 | ++ (instancetype)messageWihtContent:(CNLiveChatMessage *)content isRight:(BOOL)isRight | |
| 35 | +{ | |
| 36 | + LVCMessage *msg = [LVCMessage new]; | |
| 37 | + msg.isRight = isRight; | |
| 38 | + msg.content = content.messageContent; | |
| 39 | + msg.nikename = content.userInfo.name; | |
| 40 | + msg.portraits = content.userInfo.portraitUri; | |
| 41 | + | |
| 42 | + CGRect rect = [msg.content boundingRectWithSize:CGSizeMake((SCREEN_WIDTH-60)*0.8, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil]; | |
| 43 | + CGRect frameOfLabel = CGRectZero; | |
| 44 | + | |
| 45 | + frameOfLabel.size = rect.size; | |
| 46 | + | |
| 47 | + if (isRight) { //我的消息 | |
| 48 | + | |
| 49 | + msg.portraitsFrame = CGRectMake(SCREEN_WIDTH-45, ICON_TOP_SPACE, ICON_WIDTH, ICON_WIDTH); | |
| 50 | + | |
| 51 | + msg.popFrame = CGRectMake(SCREEN_WIDTH-60-CGRectGetWidth(rect)-POP_TOP_SPACE, POP_TOP_SPACE, CGRectGetWidth(rect)+2*POP_TOP_SPACE, CGRectGetHeight(rect)+2*POP_TOP_SPACE); | |
| 52 | + | |
| 53 | + msg.contentFrame = CGRectMake(POP_TOP_SPACE, POP_TOP_SPACE, CGRectGetWidth(rect), CGRectGetHeight(rect)); | |
| 54 | + | |
| 55 | + msg.cellHeight = CGRectGetHeight(msg.popFrame)+20; | |
| 56 | + | |
| 57 | + } else { //收到的消息 | |
| 58 | + | |
| 59 | + msg.nikenameFrame = CGRectMake(POP_TOP_SPACE, ICON_TOP_SPACE, CGRectGetWidth(rect), 12); | |
| 60 | + | |
| 61 | + msg.lineFrame = CGRectMake(POP_TOP_SPACE, 25, CGRectGetWidth(rect), 0.5); | |
| 62 | + | |
| 63 | + msg.portraitsFrame = CGRectMake(10, ICON_TOP_SPACE , ICON_WIDTH, ICON_WIDTH); | |
| 64 | + | |
| 65 | + msg.popFrame = CGRectMake(50, POP_TOP_SPACE , CGRectGetWidth(rect)+2*POP_TOP_SPACE, CGRectGetHeight(rect)+2*POP_TOP_SPACE+20); | |
| 66 | + | |
| 67 | + msg.contentFrame = CGRectMake(POP_TOP_SPACE, 30, CGRectGetWidth(rect), CGRectGetHeight(rect)); | |
| 68 | + | |
| 69 | + msg.cellHeight = CGRectGetHeight(msg.popFrame)+20; | |
| 70 | + | |
| 71 | + } | |
| 72 | + | |
| 73 | + return msg; | |
| 74 | +} | |
| 75 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #import "LVCInteractionController.h" |
| 12 | 12 | #import "LVCLivePlayerController.h" |
| 13 | 13 | #import "LVCUGCLivePlayerController.h" |
| 14 | +#import "LVCTVLiveViewController.h" | |
| 14 | 15 | |
| 15 | 16 | @interface HomeViewController () |
| 16 | 17 | |
| ... | ... | @@ -55,8 +56,8 @@ |
| 55 | 56 | |
| 56 | 57 | - (void)liveAction |
| 57 | 58 | { |
| 58 | - LVCLivePlayerController *liveVC = [[LVCLivePlayerController alloc] init]; | |
| 59 | - self.navigationController.navigationBar.hidden = YES; | |
| 59 | + LVCTVLiveViewController *liveVC = [[LVCTVLiveViewController alloc] init]; | |
| 60 | +// self.navigationController.navigationBar.hidden = YES; | |
| 60 | 61 | [self.navigationController pushViewController:liveVC animated:YES]; |
| 61 | 62 | } |
| 62 | 63 | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCLivePlayerController.m
| ... | ... | @@ -15,10 +15,10 @@ |
| 15 | 15 | @interface LVCLivePlayerController ()<LVCPlayerDelegate,LVCInputViewDelegate> |
| 16 | 16 | { |
| 17 | 17 | BOOL isHiddenStatusBar; //记录状态的隐藏显示 |
| 18 | - CGRect playerFrame; // | |
| 18 | + CGRect playerFrame; //播放器原始位置 | |
| 19 | 19 | NSInteger _originalDirection; //记录原始方向 |
| 20 | - | |
| 21 | 20 | CGFloat keyboardHeight; //键盘高度 |
| 21 | + NSString *_roomId; //聊天室ID | |
| 22 | 22 | |
| 23 | 23 | } |
| 24 | 24 | @property (nonatomic, strong) LVCPlayer *player; |
| ... | ... | @@ -34,6 +34,8 @@ |
| 34 | 34 | { |
| 35 | 35 | [super viewWillAppear:animated]; |
| 36 | 36 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; |
| 37 | + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; | |
| 38 | + | |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | - (void)viewWillDisappear:(BOOL)animated |
| ... | ... | @@ -45,9 +47,9 @@ |
| 45 | 47 | |
| 46 | 48 | - (void)viewDidLoad { |
| 47 | 49 | [super viewDidLoad]; |
| 48 | - | |
| 49 | 50 | self.view.backgroundColor = [UIColor blackColor]; |
| 50 | 51 | |
| 52 | + _roomId = @"778899"; | |
| 51 | 53 | playerFrame = CGRectMake(0, 20, SCREEN_WIDTH, SCREEN_WIDTH*9/16); |
| 52 | 54 | _originalDirection = 0; |
| 53 | 55 | |
| ... | ... | @@ -58,7 +60,18 @@ |
| 58 | 60 | [self.view addSubview:self.chatView]; |
| 59 | 61 | [self.view addSubview:self.inputView]; |
| 60 | 62 | |
| 63 | + //隐藏和显示输入框 | |
| 64 | + __weak typeof(self) weakSelf = self; | |
| 65 | + self.player.hideBlock = ^(BOOL hide) { | |
| 66 | + weakSelf.inputView.hidden = hide; | |
| 67 | + if (!hide) { | |
| 68 | + [weakSelf.inputView.inputTextField becomeFirstResponder]; | |
| 69 | + } | |
| 70 | + }; | |
| 71 | + | |
| 61 | 72 | [self makeConstraints]; |
| 73 | + | |
| 74 | + [_player autoHideControlView]; //自动隐藏工具条 | |
| 62 | 75 | } |
| 63 | 76 | |
| 64 | 77 | - (void)addObservers |
| ... | ... | @@ -136,13 +149,17 @@ |
| 136 | 149 | _inputView.frame = CGRectMake(0, SCREEN_HEIGHT-50, SCREEN_WIDTH, 50); |
| 137 | 150 | } |
| 138 | 151 | |
| 152 | +#pragma mark - | |
| 153 | +#pragma mark - 屏幕旋转 | |
| 139 | 154 | //旋转至全屏 |
| 140 | 155 | - (void)toFullWithrotationAngle:(CGFloat)angle |
| 141 | 156 | { |
| 157 | + _inputView.hidden = YES; | |
| 158 | + | |
| 142 | 159 | if (_player.isFullScreen) return; |
| 143 | 160 | |
| 144 | 161 | _player.isFullScreen = YES; |
| 145 | - | |
| 162 | + | |
| 146 | 163 | [self presentViewController:self.fullVC animated:NO completion:^{ |
| 147 | 164 | [_player removeFromSuperview]; |
| 148 | 165 | [self.fullVC.view addSubview:self.player]; |
| ... | ... | @@ -162,6 +179,7 @@ |
| 162 | 179 | - (void)toHalfScreenWithrotationAngle:(CGFloat)angle |
| 163 | 180 | { |
| 164 | 181 | _player.isFullScreen = NO; |
| 182 | + _inputView.hidden = NO; | |
| 165 | 183 | |
| 166 | 184 | [_fullVC dismissViewControllerAnimated:NO completion:^{ |
| 167 | 185 | [_player removeFromSuperview]; |
| ... | ... | @@ -187,6 +205,10 @@ |
| 187 | 205 | self.player.isFullScreen = NO; |
| 188 | 206 | } else { |
| 189 | 207 | [_player stopPlaying]; |
| 208 | + | |
| 209 | + //退出聊天室 | |
| 210 | + [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_roomId success:NULL error:NULL]; | |
| 211 | + | |
| 190 | 212 | self.navigationController.navigationBar.hidden = NO; |
| 191 | 213 | [self.navigationController popViewControllerAnimated:YES]; |
| 192 | 214 | } |
| ... | ... | @@ -213,6 +235,8 @@ |
| 213 | 235 | - (void)lvcInputView:(LVCInputView *)inputView sendMessage:(NSString *)message |
| 214 | 236 | { |
| 215 | 237 | NSLog(@"发送消息(%@)",message); |
| 238 | + | |
| 239 | + [_chatView sendMsgWithMessage:message]; | |
| 216 | 240 | |
| 217 | 241 | } |
| 218 | 242 | |
| ... | ... | @@ -221,6 +245,7 @@ |
| 221 | 245 | [self.view endEditing:YES]; |
| 222 | 246 | } |
| 223 | 247 | |
| 248 | + | |
| 224 | 249 | #pragma mark - |
| 225 | 250 | #pragma mark - makeConstraints |
| 226 | 251 | - (void)makeConstraints |
| ... | ... | @@ -238,21 +263,17 @@ |
| 238 | 263 | - (void)makePlayerViewConstraints:(BOOL)fullScreen |
| 239 | 264 | { |
| 240 | 265 | if (fullScreen) { //全屏 |
| 241 | - | |
| 242 | 266 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { |
| 243 | 267 | make.top.left.right.bottom.mas_equalTo(0); |
| 244 | 268 | }]; |
| 245 | - | |
| 246 | 269 | _inputView.frame = CGRectMake(0, SCREEN_HEIGHT-50, SCREEN_WIDTH, 49); |
| 247 | 270 | |
| 248 | 271 | } else { //半屏 |
| 249 | - | |
| 250 | 272 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { |
| 251 | 273 | make.top.mas_equalTo(20); |
| 252 | 274 | make.left.right.mas_equalTo(0); |
| 253 | 275 | make.height.equalTo(@(playerFrame.size.height)); |
| 254 | 276 | }]; |
| 255 | - | |
| 256 | 277 | _inputView.frame = CGRectMake(0, SCREEN_HEIGHT-50, SCREEN_WIDTH, 49); |
| 257 | 278 | |
| 258 | 279 | } |
| ... | ... | @@ -289,7 +310,7 @@ |
| 289 | 310 | - (LVCChatView *)chatView |
| 290 | 311 | { |
| 291 | 312 | if (!_chatView) { |
| 292 | - _chatView = [[LVCChatView alloc] initWithFrame:CGRectMake(0, SCREEN_WIDTH*9/16+20, SCREEN_WIDTH, SCREEN_HEIGHT-SCREEN_WIDTH*9/16-20-49) roomId:@"1122"]; | |
| 313 | + _chatView = [[LVCChatView alloc] initWithFrame:CGRectMake(0, SCREEN_WIDTH*9/16+20, SCREEN_WIDTH, SCREEN_HEIGHT-SCREEN_WIDTH*9/16-20-49) roomId:_roomId]; | |
| 293 | 314 | } |
| 294 | 315 | return _chatView; |
| 295 | 316 | } | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCMoreProgramViewController.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCMoreProgramViewController.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface LVCMoreProgramViewController : UIViewController | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) NSString *cid; | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCMoreProgramViewController.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCMoreProgramViewController.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCMoreProgramViewController.h" | |
| 10 | +#import "LVCMoreSortTableViewCell.h" | |
| 11 | +#import "LVCProgramModel.h" | |
| 12 | + | |
| 13 | +@interface LVCMoreProgramViewController ()<UITableViewDelegate,UITableViewDataSource> | |
| 14 | +{ | |
| 15 | + NSMutableArray *_data; | |
| 16 | + int _page; //请求数据的页数 | |
| 17 | + int _next; | |
| 18 | +} | |
| 19 | +@property (nonatomic, strong)UITableView *tableView; | |
| 20 | +@property (nonatomic, strong) UIView *bbView; | |
| 21 | + | |
| 22 | +@end | |
| 23 | + | |
| 24 | +@implementation LVCMoreProgramViewController | |
| 25 | + | |
| 26 | +- (void)viewDidLoad { | |
| 27 | + [super viewDidLoad]; | |
| 28 | + self.view.backgroundColor = [UIColor backgroundColorZX]; | |
| 29 | + _data = [[NSMutableArray alloc] init]; | |
| 30 | + [self.view addSubview:self.tableView]; | |
| 31 | +} | |
| 32 | + | |
| 33 | +- (void)setCid:(NSString *)cid { | |
| 34 | + _cid = cid; | |
| 35 | + [self.tableView.header beginRefreshing]; | |
| 36 | +} | |
| 37 | + | |
| 38 | +- (void)request:(int)page refresh:(BOOL)refresh | |
| 39 | +{ | |
| 40 | + NSDictionary *parameters = @{@"page": [NSString stringWithFormat:@"%d", page], | |
| 41 | + @"pagesize": @"15", | |
| 42 | + @"cid": self.cid ? self.cid : @"", | |
| 43 | + @"type": @"live", | |
| 44 | + @"version": @"5.3", @"appid": @"spzg", @"plat": @"a"}; | |
| 45 | + [[AFHTTPSessionManager manager] GET:@"http://app.jczb.cnlive.com/api/catprogramlist" parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 46 | + | |
| 47 | + if (refresh) { | |
| 48 | + _page = 1; | |
| 49 | + [_tableView.header endRefreshing]; | |
| 50 | + [_data removeAllObjects]; | |
| 51 | + } else { | |
| 52 | + [_tableView.footer endRefreshing]; | |
| 53 | + } | |
| 54 | + | |
| 55 | + _next = [[responseObject objectForKey:@"next_cursor"] intValue]; | |
| 56 | + for (NSDictionary *dic in [responseObject objectForKey:@"programs"]) { | |
| 57 | + LVCProgramModel *model = [LVCProgramModel mj_objectWithKeyValues:dic]; | |
| 58 | + [_data addObject:model]; | |
| 59 | + } | |
| 60 | + | |
| 61 | + [_tableView reloadData]; | |
| 62 | + | |
| 63 | + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 64 | + if (refresh) { | |
| 65 | + [_tableView.header endRefreshing]; | |
| 66 | + } else { | |
| 67 | + _page -= 1; | |
| 68 | + [_tableView.footer endRefreshing]; | |
| 69 | + } | |
| 70 | + | |
| 71 | + NSLog(@"电视台更多节目列表获取失败"); | |
| 72 | + | |
| 73 | + }]; | |
| 74 | +} | |
| 75 | + | |
| 76 | + | |
| 77 | +- (void)refreshAction | |
| 78 | +{ | |
| 79 | + [self request:1 refresh:YES]; | |
| 80 | +} | |
| 81 | + | |
| 82 | +- (void)loadMoreAction | |
| 83 | +{ | |
| 84 | + _page += 1; | |
| 85 | + if (_next == 0) { | |
| 86 | + if (_page != 1) { | |
| 87 | + [_tableView.footer endRefreshing]; | |
| 88 | + return ; | |
| 89 | + } | |
| 90 | + } else { | |
| 91 | + [self request:_page refresh:NO]; | |
| 92 | + } | |
| 93 | +} | |
| 94 | + | |
| 95 | +#pragma mark - | |
| 96 | +#pragma mark - UITableView | |
| 97 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
| 98 | +{ | |
| 99 | + return _data.count; | |
| 100 | +} | |
| 101 | + | |
| 102 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| 103 | +{ | |
| 104 | + static NSString *identify = @"liveMoreProgramCell"; | |
| 105 | + LVCMoreSortTableViewCell *cell = (LVCMoreSortTableViewCell *)[tableView dequeueReusableCellWithIdentifier:identify]; | |
| 106 | + if (cell == nil) { | |
| 107 | + cell = [[LVCMoreSortTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify]; | |
| 108 | + if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { | |
| 109 | + cell.separatorInset = UIEdgeInsetsZero; | |
| 110 | + } | |
| 111 | + if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { | |
| 112 | + cell.layoutMargins = UIEdgeInsetsZero; | |
| 113 | + } | |
| 114 | + } | |
| 115 | + cell.model = [_data objectAtIndex:indexPath.row]; | |
| 116 | + return cell; | |
| 117 | +} | |
| 118 | + | |
| 119 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
| 120 | +{ | |
| 121 | + if (SCREEN_WIDTH == 320.0) { | |
| 122 | + return 80.0; | |
| 123 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 124 | + return 93.0; | |
| 125 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 126 | + return 103.0; | |
| 127 | + } | |
| 128 | + | |
| 129 | + return 93.0; | |
| 130 | +} | |
| 131 | + | |
| 132 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
| 133 | +{ | |
| 134 | + [tableView deselectRowAtIndexPath:indexPath animated:YES]; | |
| 135 | + | |
| 136 | +} | |
| 137 | + | |
| 138 | +#pragma mark - | |
| 139 | +#pragma mark - getter | |
| 140 | +- (UITableView *)tableView | |
| 141 | +{ | |
| 142 | + if (!_tableView) { | |
| 143 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain]; | |
| 144 | + _tableView.showsHorizontalScrollIndicator = NO; | |
| 145 | + _tableView.showsVerticalScrollIndicator = NO; | |
| 146 | + _tableView.delegate = self; | |
| 147 | + _tableView.dataSource = self; | |
| 148 | + // _tableView.rowHeight = 98; | |
| 149 | + _tableView.backgroundColor = [UIColor clearColor]; | |
| 150 | + _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; | |
| 151 | + _tableView.header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshAction)]; | |
| 152 | + _tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreAction)]; | |
| 153 | + if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) { | |
| 154 | + [_tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)]; | |
| 155 | + } | |
| 156 | + | |
| 157 | + if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) { | |
| 158 | + [_tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)]; | |
| 159 | + } | |
| 160 | + _tableView.backgroundColor = [UIColor clearColor]; | |
| 161 | + } | |
| 162 | + return _tableView; | |
| 163 | +} | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | +- (void)didReceiveMemoryWarning { | |
| 168 | + [super didReceiveMemoryWarning]; | |
| 169 | + // Dispose of any resources that can be recreated. | |
| 170 | +} | |
| 171 | + | |
| 172 | +/* | |
| 173 | +#pragma mark - Navigation | |
| 174 | + | |
| 175 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 176 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 177 | + // Get the new view controller using [segue destinationViewController]. | |
| 178 | + // Pass the selected object to the new view controller. | |
| 179 | +} | |
| 180 | +*/ | |
| 181 | + | |
| 182 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCTVLiveViewController.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCTVLiveViewController.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCLiveViewController.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCTVLiveViewController.h" | |
| 10 | +#import "LVCTelevisionView.h" | |
| 11 | + | |
| 12 | +@interface LVCTVLiveViewController () | |
| 13 | + | |
| 14 | +@property (nonatomic, strong) LVCTelevisionView *tvView; | |
| 15 | + | |
| 16 | +@end | |
| 17 | + | |
| 18 | +@implementation LVCTVLiveViewController | |
| 19 | + | |
| 20 | +- (void)viewDidLoad { | |
| 21 | + [super viewDidLoad]; | |
| 22 | + | |
| 23 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 24 | + | |
| 25 | + [self.view addSubview:self.tvView]; | |
| 26 | +} | |
| 27 | + | |
| 28 | +- (LVCTelevisionView *)tvView | |
| 29 | +{ | |
| 30 | + if (!_tvView) { | |
| 31 | + _tvView = [[LVCTelevisionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; | |
| 32 | + } | |
| 33 | + return _tvView; | |
| 34 | +} | |
| 35 | + | |
| 36 | +- (void)didReceiveMemoryWarning { | |
| 37 | + [super didReceiveMemoryWarning]; | |
| 38 | + // Dispose of any resources that can be recreated. | |
| 39 | +} | |
| 40 | + | |
| 41 | +/* | |
| 42 | +#pragma mark - Navigation | |
| 43 | + | |
| 44 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 45 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 46 | + // Get the new view controller using [segue destinationViewController]. | |
| 47 | + // Pass the selected object to the new view controller. | |
| 48 | +} | |
| 49 | +*/ | |
| 50 | + | |
| 51 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCBannerModel.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCBannerModel.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +@interface LVCBannerModel : NSObject | |
| 12 | + | |
| 13 | + | |
| 14 | +@property (nonatomic, copy) NSString *img; // 滚动图片 url | |
| 15 | +@property (nonatomic, copy) NSString *title; // 滚动小标题 | |
| 16 | +@property (nonatomic, copy) NSString *type; | |
| 17 | +@property (nonatomic, copy) NSString *mediaId; | |
| 18 | +@property (nonatomic, copy) NSString *docID; | |
| 19 | +@property (nonatomic, copy) NSString *activityId; | |
| 20 | +@property (nonatomic, copy) NSString *url; | |
| 21 | +@property (nonatomic, copy) NSString *subTitle; | |
| 22 | +@property (nonatomic, copy) NSString *currentPlay; // 正在直播 | |
| 23 | +@property (nonatomic, copy) NSString *nextPlay; // 即将直播 | |
| 24 | + | |
| 25 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCBannerModel.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCBannerModel.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCBannerModel.h" | |
| 10 | + | |
| 11 | +@implementation LVCBannerModel | |
| 12 | + | |
| 13 | +- (void)setValue:(id)value forUndefinedKey:(NSString *)key{} | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChannelDetailsModel.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCChannelDetailsModel.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +@interface LVCChannelDetailsModel : NSObject | |
| 12 | + | |
| 13 | + | |
| 14 | +// 直播播放 channelId | |
| 15 | +@property (nonatomic, copy) NSString *mediaId; | |
| 16 | +// 播放类型 live直播 | |
| 17 | +@property (nonatomic, copy) NSString *type; | |
| 18 | +// 节目名称 | |
| 19 | +@property (nonatomic, copy) NSString *title; | |
| 20 | +// 节目详情 | |
| 21 | +@property (nonatomic, copy) NSString *subTitle; | |
| 22 | +// 节目图片 | |
| 23 | +@property (nonatomic, copy) NSString *img; | |
| 24 | +// 正在直播 | |
| 25 | +@property (nonatomic, copy) NSString *currentPlay; | |
| 26 | +// 即将直播 | |
| 27 | +@property (nonatomic, copy) NSString *nextPlay; | |
| 28 | +// 活动id (???) | |
| 29 | +@property (nonatomic, copy) NSString *activityId; | |
| 30 | +@property (nonatomic, copy) NSString *docID; | |
| 31 | +@property (nonatomic, copy) NSString *desc; | |
| 32 | + | |
| 33 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChannelDetailsModel.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCChannelDetailsModel.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCChannelDetailsModel.h" | |
| 10 | + | |
| 11 | +@implementation LVCChannelDetailsModel | |
| 12 | + | |
| 13 | +- (void)setValue:(id)value forUndefinedKey:(NSString *)key { | |
| 14 | + | |
| 15 | +} | |
| 16 | + | |
| 17 | +- (NSString *)description { | |
| 18 | + | |
| 19 | + return [NSString stringWithFormat:@"mediaId:%@, type:%@, title:%@, img:%@",_mediaId,_type,_title,_img]; | |
| 20 | +} | |
| 21 | + | |
| 22 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChannelsModel.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCChannelsModel.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | +#import "LVCChannelDetailsModel.h" | |
| 11 | + | |
| 12 | +@interface LVCChannelsModel : NSObject | |
| 13 | + | |
| 14 | +@property (nonatomic, copy) NSString *title; | |
| 15 | +// 列表详情模型数组 | |
| 16 | +@property (nonatomic, strong) NSArray <LVCChannelDetailsModel *> *programs; | |
| 17 | +@property (nonatomic, copy) NSString *cid; | |
| 18 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChannelsModel.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCChannelsModel.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCChannelsModel.h" | |
| 10 | + | |
| 11 | +@implementation LVCChannelsModel | |
| 12 | + | |
| 13 | +- (void)setValue:(id)value forKey:(NSString *)key { | |
| 14 | + | |
| 15 | + if ([key isEqualToString:@"programs"]) { | |
| 16 | + | |
| 17 | + NSArray *array = value; | |
| 18 | + | |
| 19 | + NSMutableArray *arrayM = [NSMutableArray array]; | |
| 20 | + | |
| 21 | + for (NSDictionary *dict in array) { | |
| 22 | + | |
| 23 | + LVCChannelDetailsModel *model = [[LVCChannelDetailsModel alloc] init]; | |
| 24 | + | |
| 25 | + [model setValuesForKeysWithDictionary:dict]; | |
| 26 | + | |
| 27 | + [arrayM addObject:model]; | |
| 28 | + } | |
| 29 | + | |
| 30 | + _programs = arrayM.copy; | |
| 31 | + | |
| 32 | + return; | |
| 33 | + } | |
| 34 | + | |
| 35 | + [super setValue:value forKey:key]; | |
| 36 | +} | |
| 37 | + | |
| 38 | +- (void)setValue:(id)value forUndefinedKey:(NSString *)key { | |
| 39 | + | |
| 40 | +} | |
| 41 | + | |
| 42 | +- (NSString *)description { | |
| 43 | + return [NSString stringWithFormat:@"title:%@, programs:%@",_title,_programs]; | |
| 44 | +} | |
| 45 | + | |
| 46 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatRoomModel.h renamed to LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChatRoomModel.h
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatRoomModel.m renamed to LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCChatRoomModel.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCProgramModel.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCProgramModel.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +@interface LVCProgramModel : NSObject | |
| 12 | + | |
| 13 | +@property (nonatomic, strong)NSString *currentPlay; | |
| 14 | +@property (nonatomic, strong)NSString *desc; | |
| 15 | +@property (nonatomic, strong)NSString *docID; | |
| 16 | +@property (nonatomic, strong)NSString *img; | |
| 17 | +@property (nonatomic, strong)NSString *mediaId; | |
| 18 | +@property (nonatomic, strong)NSString *nextPlay; | |
| 19 | +@property (nonatomic, strong)NSString *subTitle; | |
| 20 | +@property (nonatomic, strong)NSString *title; | |
| 21 | +@property (nonatomic, strong)NSString *type; | |
| 22 | +@property (nonatomic, strong)NSString *vipFlag; | |
| 23 | + | |
| 24 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCProgramModel.m
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCFirstHeaderReusableView.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCFirstHeaderReusableView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "LVCBannerModel.h" | |
| 11 | + | |
| 12 | +@interface LVCFirstHeaderReusableView : UICollectionReusableView | |
| 13 | + | |
| 14 | +@property (nonatomic, strong) NSArray <NSURL *> *imageUrls; | |
| 15 | +@property (nonatomic, strong) NSArray <LVCBannerModel *> *modelArray; | |
| 16 | + | |
| 17 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCFirstHeaderReusableView.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCFirstHeaderReusableView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCFirstHeaderReusableView.h" | |
| 10 | +#import "LVCHeaderRollCollectionViewCell.h" | |
| 11 | +#import "LVCLivePlayerController.h" | |
| 12 | + | |
| 13 | +#define kDataScaleSeed 100 | |
| 14 | +static NSString *cellId = @"cellId"; | |
| 15 | + | |
| 16 | +@interface CZSlideLayout: UICollectionViewFlowLayout | |
| 17 | + | |
| 18 | +@end | |
| 19 | +@implementation CZSlideLayout | |
| 20 | + | |
| 21 | +- (void)prepareLayout { | |
| 22 | + [super prepareLayout]; | |
| 23 | + self.itemSize = self.collectionView.bounds.size; | |
| 24 | + self.minimumLineSpacing = 0; | |
| 25 | + self.minimumInteritemSpacing = 0; | |
| 26 | + self.scrollDirection = UICollectionViewScrollDirectionHorizontal; | |
| 27 | +} | |
| 28 | +@end | |
| 29 | + | |
| 30 | +@interface LVCFirstHeaderReusableView ()<UICollectionViewDelegate,UICollectionViewDataSource> | |
| 31 | +{ | |
| 32 | + // 定时器 | |
| 33 | + NSTimer *_timer; | |
| 34 | + // 定时器触发时间 | |
| 35 | + NSTimeInterval _timerDuration; | |
| 36 | +} | |
| 37 | + | |
| 38 | +@property (nonatomic, weak) UICollectionView *collectionView; | |
| 39 | +@property (nonatomic, weak) UIPageControl *pageControl; | |
| 40 | +@property (nonatomic, strong)UIButton *button; | |
| 41 | +@property (nonatomic, strong)UILabel *cycleViewTitle; //轮播下方标题 | |
| 42 | + | |
| 43 | +@end | |
| 44 | + | |
| 45 | +@implementation LVCFirstHeaderReusableView | |
| 46 | + | |
| 47 | +#pragma mark - 构造函数 | |
| 48 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 49 | +{ | |
| 50 | + self = [super initWithFrame:frame]; | |
| 51 | + if (self) { | |
| 52 | + [self setupUI]; | |
| 53 | + } | |
| 54 | + return self; | |
| 55 | +} | |
| 56 | + | |
| 57 | +#pragma mark - 设置数据 | |
| 58 | +- (void)setImageUrls:(NSArray<NSURL *> *)imageUrls { | |
| 59 | + _imageUrls = imageUrls; | |
| 60 | + | |
| 61 | + if (_timer != nil) { | |
| 62 | + [_timer invalidate]; | |
| 63 | + } | |
| 64 | + [_collectionView reloadData]; | |
| 65 | + [self addSubview:self.cycleViewTitle]; | |
| 66 | + | |
| 67 | + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:_imageUrls.count * kDataScaleSeed inSection:0]; | |
| 68 | + | |
| 69 | + [_collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:NO]; | |
| 70 | + | |
| 71 | + // _pageControl.currentPage = 0; | |
| 72 | + // _pageControl.numberOfPages = _imageUrls.count; | |
| 73 | + | |
| 74 | + _timerDuration = 4.0; | |
| 75 | + _timer = [NSTimer timerWithTimeInterval:_timerDuration target:self selector:@selector(updateTimer) userInfo:nil repeats:YES]; | |
| 76 | + | |
| 77 | + [[NSRunLoop currentRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes]; | |
| 78 | +} | |
| 79 | + | |
| 80 | +- (void)setModelArray:(NSArray<LVCBannerModel *> *)modelArray { | |
| 81 | + _modelArray = modelArray; | |
| 82 | + self.cycleViewTitle.text = [NSString stringWithFormat:@" %@",_modelArray[0].title]; | |
| 83 | +} | |
| 84 | + | |
| 85 | +#pragma mark - 子视图 | |
| 86 | +- (UILabel *)cycleViewTitle | |
| 87 | +{ | |
| 88 | + if (!_cycleViewTitle) { | |
| 89 | + | |
| 90 | + _cycleViewTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, self.collectionView.bottom-35, self.collectionView.width, 35)]; | |
| 91 | + _cycleViewTitle.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; | |
| 92 | + _cycleViewTitle.textColor = [UIColor whiteColor]; | |
| 93 | + _cycleViewTitle.font = [UIFont systemFontOfSize:19]; | |
| 94 | + } | |
| 95 | + return _cycleViewTitle; | |
| 96 | +} | |
| 97 | + | |
| 98 | +#pragma mark - 时钟方法 | |
| 99 | +- (void)updateTimer { | |
| 100 | + | |
| 101 | + NSIndexPath *indexPath = [_collectionView indexPathsForVisibleItems].lastObject; | |
| 102 | + NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:indexPath.item + 1 inSection:indexPath.section]; | |
| 103 | + | |
| 104 | + [_collectionView scrollToItemAtIndexPath:newIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES]; | |
| 105 | +} | |
| 106 | + | |
| 107 | +#pragma mark - UICollectionViewDataSource 数据源协议方法! | |
| 108 | +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | |
| 109 | + | |
| 110 | + return _imageUrls.count * kDataScaleSeed * 2; | |
| 111 | +} | |
| 112 | + | |
| 113 | +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
| 114 | + | |
| 115 | + LVCHeaderRollCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; | |
| 116 | + NSInteger index = indexPath.item % _imageUrls.count; | |
| 117 | + cell.imageUrl = _imageUrls[index]; | |
| 118 | + return cell; | |
| 119 | +} | |
| 120 | + | |
| 121 | +#pragma mark - UICollectionViewDelegate | |
| 122 | +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { | |
| 123 | + | |
| 124 | + if (_imageUrls.count == 0) { | |
| 125 | + return; | |
| 126 | + } | |
| 127 | + | |
| 128 | + CGFloat offsetX = scrollView.contentOffset.x / scrollView.bounds.size.width; | |
| 129 | + | |
| 130 | + // 2. 根据 offsetX 四舍五入计算页数 | |
| 131 | + NSInteger page = (NSInteger)(offsetX + 0.5); | |
| 132 | + | |
| 133 | + // 3. 根据数组数量,取余数 | |
| 134 | + page = page % _imageUrls.count; | |
| 135 | + | |
| 136 | + // NSLog(@"%zd!!!", page); | |
| 137 | + | |
| 138 | + _pageControl.currentPage = page; | |
| 139 | + | |
| 140 | + self.cycleViewTitle.text = [NSString stringWithFormat:@" %@",_modelArray[page].title]; | |
| 141 | +} | |
| 142 | + | |
| 143 | +/** | |
| 144 | + * 通过设置 contentOffset 动画滚动完成之后调用 | |
| 145 | + */ | |
| 146 | +- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { | |
| 147 | + // 主动调用动画停止代理方法 | |
| 148 | + [self scrollViewDidEndDecelerating:scrollView]; | |
| 149 | +} | |
| 150 | + | |
| 151 | +/** | |
| 152 | + * 滚动视图停止滚动会调用 | |
| 153 | + */ | |
| 154 | +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { | |
| 155 | + | |
| 156 | + // 根据 contentOffset.x 判断页数 | |
| 157 | + NSInteger page = scrollView.contentOffset.x / scrollView.bounds.size.width; | |
| 158 | + | |
| 159 | + // lastItem = _imageUrl.count * 2 | |
| 160 | + NSInteger lastItem = [_collectionView numberOfItemsInSection:0]; | |
| 161 | + | |
| 162 | + // NSLog(@"第 %zd 页 - lastItem %zd", page, lastItem); | |
| 163 | + // 只处理第 0 页,和最后一页 | |
| 164 | + if (page == 0 || page == (lastItem - 1)) { | |
| 165 | + // 如果是 0 页,跳转到 _imageUrl.count | |
| 166 | + // 如果是最后一页,跳转到 _imageUrl.count - 1 | |
| 167 | + NSInteger offset = _imageUrls.count * kDataScaleSeed; | |
| 168 | + | |
| 169 | + // 判断最后一页 | |
| 170 | + if (page == (lastItem - 1)) { | |
| 171 | + offset = offset - 1; // (5 - 1) * 10 = 40 // 5 * 10 - 1 | |
| 172 | + } | |
| 173 | + | |
| 174 | + // 设置 contentOffset | |
| 175 | + // NSLog(@"我要跳转到 %zd", offset); | |
| 176 | + | |
| 177 | + CGFloat width = scrollView.bounds.size.width; | |
| 178 | + | |
| 179 | + scrollView.contentOffset = CGPointMake(offset * width, 0); | |
| 180 | + } | |
| 181 | +} | |
| 182 | + | |
| 183 | +// 开始拖,暂停时钟! | |
| 184 | +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
| 185 | + | |
| 186 | + _timer.fireDate = [NSDate distantFuture]; | |
| 187 | +} | |
| 188 | + | |
| 189 | +// 结束拖,继续时钟! | |
| 190 | +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { | |
| 191 | + | |
| 192 | + _timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:_timerDuration]; | |
| 193 | +} | |
| 194 | + | |
| 195 | +// 选择 | |
| 196 | +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath | |
| 197 | +{ | |
| 198 | + /* | |
| 199 | + LVCBannerModel *model = self.modelArray[indexPath.row % 5]; | |
| 200 | + LVCLivePlayerController *player = [[LVCLivePlayerController alloc]init]; | |
| 201 | + [self.viewController.navigationController pushViewController:player animated:YES]; | |
| 202 | + */ | |
| 203 | +} | |
| 204 | + | |
| 205 | +#pragma mark - 第一个组头设置界面 | |
| 206 | +- (void)setupUI { | |
| 207 | + | |
| 208 | + CZSlideLayout *layout = [[CZSlideLayout alloc] init]; | |
| 209 | + UICollectionView *cv = [[UICollectionView alloc] initWithFrame:CGRectMake(10, 7, SCREEN_WIDTH-20, (SCREEN_WIDTH-20)/2) collectionViewLayout:layout]; | |
| 210 | + cv.backgroundColor = [UIColor whiteColor]; | |
| 211 | + | |
| 212 | + [self addSubview:cv]; | |
| 213 | + | |
| 214 | + [cv registerClass:[LVCHeaderRollCollectionViewCell class] forCellWithReuseIdentifier:cellId]; | |
| 215 | + | |
| 216 | + cv.dataSource = self; | |
| 217 | + cv.delegate = self; | |
| 218 | + | |
| 219 | + cv.pagingEnabled = YES; | |
| 220 | + cv.showsVerticalScrollIndicator = NO; | |
| 221 | + cv.showsHorizontalScrollIndicator = NO; | |
| 222 | + cv.bounces = NO; | |
| 223 | + | |
| 224 | + UIPageControl *pager = [[UIPageControl alloc] init]; | |
| 225 | + pager.numberOfPages = 0; | |
| 226 | + pager.currentPage = 0; | |
| 227 | + pager.currentPageIndicatorTintColor = [UIColor yellowColor]; | |
| 228 | + pager.pageIndicatorTintColor = [UIColor redColor]; | |
| 229 | + pager.userInteractionEnabled = NO; | |
| 230 | + | |
| 231 | + _collectionView = cv; | |
| 232 | + _pageControl = pager; | |
| 233 | +} | |
| 234 | + | |
| 235 | +- (void)removeFromSuperview { | |
| 236 | + [super removeFromSuperview]; | |
| 237 | + | |
| 238 | + [_timer invalidate]; | |
| 239 | +} | |
| 240 | + | |
| 241 | +// 添加了时钟 & 运行循环,dealloc 方法不会被调用! | |
| 242 | +- (void)dealloc { | |
| 243 | + | |
| 244 | +} | |
| 245 | + | |
| 246 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCHeaderRollCollectionViewCell.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCHeaderRollCollectionViewCell.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface LVCHeaderRollCollectionViewCell : UICollectionViewCell | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) NSURL *imageUrl; | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCHeaderRollCollectionViewCell.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCHeaderRollCollectionViewCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCHeaderRollCollectionViewCell.h" | |
| 10 | + | |
| 11 | +@interface LVCHeaderRollCollectionViewCell () | |
| 12 | + | |
| 13 | +@property (nonatomic, weak) UIImageView *imageView; | |
| 14 | + | |
| 15 | +@end | |
| 16 | + | |
| 17 | +@implementation LVCHeaderRollCollectionViewCell | |
| 18 | + | |
| 19 | +#pragma mark - 构造函数 | |
| 20 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 21 | +{ | |
| 22 | + self = [super initWithFrame:frame]; | |
| 23 | + if (self) { | |
| 24 | + [self setupUI]; | |
| 25 | + } | |
| 26 | + return self; | |
| 27 | +} | |
| 28 | + | |
| 29 | +#pragma mark - 设置数据 | |
| 30 | +- (void)setImageUrl:(NSURL *)imageUrl { | |
| 31 | + _imageUrl = imageUrl; | |
| 32 | + | |
| 33 | + [_imageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"频道页—轮播图"]]; | |
| 34 | +} | |
| 35 | + | |
| 36 | +#pragma mark - 设置轮播cell界面 | |
| 37 | +- (void)setupUI | |
| 38 | +{ | |
| 39 | + UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-20, (SCREEN_WIDTH-20)/2)]; | |
| 40 | + iv.backgroundColor = [UIColor whiteColor]; | |
| 41 | + iv.contentMode = UIViewContentModeScaleToFill; | |
| 42 | + [self.contentView addSubview:iv]; | |
| 43 | + | |
| 44 | + _imageView = iv; | |
| 45 | +} | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCLiveListCollectionViewCell.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCLiveListCollectionViewCell.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "LVCChannelDetailsModel.h" | |
| 11 | + | |
| 12 | +@interface LVCLiveListCollectionViewCell : UICollectionViewCell | |
| 13 | + | |
| 14 | +@property (nonatomic, strong) LVCChannelDetailsModel *details; | |
| 15 | + | |
| 16 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCLiveListCollectionViewCell.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCLiveListCollectionViewCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCLiveListCollectionViewCell.h" | |
| 10 | + | |
| 11 | +// 首页横版cell比例 | |
| 12 | +#define H_Cell_Ratio (196.0/300) | |
| 13 | + | |
| 14 | +@interface LVCLiveListCollectionViewCell () | |
| 15 | + | |
| 16 | +@property (nonatomic, strong)UIImageView *image; | |
| 17 | +@property (nonatomic, strong)UILabel *title; | |
| 18 | +@property (nonatomic, strong)UILabel *detail; | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@implementation LVCLiveListCollectionViewCell | |
| 23 | + | |
| 24 | +#pragma mark - 构造函数 | |
| 25 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 26 | +{ | |
| 27 | + self = [super initWithFrame:frame]; | |
| 28 | + if (self) { | |
| 29 | + self.backgroundColor = [UIColor yellowColorZX]; | |
| 30 | + [self setupUI]; | |
| 31 | + } | |
| 32 | + return self; | |
| 33 | +} | |
| 34 | + | |
| 35 | +- (void)setDetails:(LVCChannelDetailsModel *)details { | |
| 36 | + | |
| 37 | + self.title.font = [UIFont systemFontOfSize:13]; | |
| 38 | + self.detail.font = [UIFont systemFontOfSize:12]; | |
| 39 | + self.title.text = [NSString stringWithFormat:@"正在直播:%@", details.currentPlay]; | |
| 40 | + self.detail.text = [NSString stringWithFormat:@"即将直播:%@", details.nextPlay]; | |
| 41 | + [self.image sd_setImageWithURL:[NSURL URLWithString:details.img] placeholderImage:[UIImage imageNamed:@"频道页占位符"]]; | |
| 42 | + self.image.contentMode = UIViewContentModeScaleAspectFill; | |
| 43 | + self.image.clipsToBounds = YES; | |
| 44 | +} | |
| 45 | + | |
| 46 | +#pragma mark - 懒加载 | |
| 47 | +- (UIImageView *)image | |
| 48 | +{ | |
| 49 | + if (!_image) { | |
| 50 | + _image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, (self.contentView.width)*H_Cell_Ratio)]; | |
| 51 | + _image.backgroundColor = [UIColor grayColor]; | |
| 52 | + } | |
| 53 | + return _image; | |
| 54 | +} | |
| 55 | + | |
| 56 | +- (UILabel *)title | |
| 57 | +{ | |
| 58 | + if (!_title) { | |
| 59 | + _title = [[UILabel alloc] initWithFrame:CGRectMake(0, self.image.bottom+7, self.contentView.width, 12)]; | |
| 60 | + _title.font = [UIFont systemFontOfSize:14]; | |
| 61 | + _title.textColor = [UIColor blackColorZX]; | |
| 62 | + } | |
| 63 | + return _title; | |
| 64 | +} | |
| 65 | + | |
| 66 | +- (UILabel *)detail | |
| 67 | +{ | |
| 68 | + if (!_detail) { | |
| 69 | + _detail = [[UILabel alloc] initWithFrame:CGRectMake(0, self.title.bottom+7, self.contentView.width, 11)]; | |
| 70 | + _detail.font = [UIFont systemFontOfSize:12]; | |
| 71 | + _detail.textColor = [UIColor grayColorZX]; | |
| 72 | + } | |
| 73 | + return _detail; | |
| 74 | +} | |
| 75 | + | |
| 76 | +#pragma mark - 设置cell | |
| 77 | +- (void)setupUI { | |
| 78 | + | |
| 79 | + self.contentView.backgroundColor = [UIColor whiteColor]; | |
| 80 | + [self.contentView addSubview:self.image]; | |
| 81 | + [self.contentView addSubview:self.title]; | |
| 82 | + [self.contentView addSubview:self.detail]; | |
| 83 | +} | |
| 84 | + | |
| 85 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCMoreSortTableViewCell.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCMoreSortTableViewCell.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "LVCProgramModel.h" | |
| 11 | + | |
| 12 | +@interface LVCMoreSortTableViewCell : UITableViewCell | |
| 13 | + | |
| 14 | +@property (nonatomic, strong) LVCProgramModel *model; | |
| 15 | + | |
| 16 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCMoreSortTableViewCell.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCMoreSortTableViewCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCMoreSortTableViewCell.h" | |
| 10 | + | |
| 11 | +@interface LVCMoreSortTableViewCell () | |
| 12 | + | |
| 13 | +@property(nonatomic,strong)UIImageView *imgView; | |
| 14 | +@property(nonatomic,strong)UILabel *titleLab; | |
| 15 | +@property(nonatomic,strong)UILabel *desLab; | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +@implementation LVCMoreSortTableViewCell | |
| 20 | + | |
| 21 | +#pragma mark - Calculate Size Specs | |
| 22 | + | |
| 23 | +- (CGFloat)imageWidth { | |
| 24 | + | |
| 25 | + if (SCREEN_WIDTH == 320.0) { | |
| 26 | + return 96.0; | |
| 27 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 28 | + return 112.0; | |
| 29 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 30 | + return 124.0; | |
| 31 | + } | |
| 32 | + | |
| 33 | + return SCREEN_WIDTH*0.3; | |
| 34 | +} | |
| 35 | + | |
| 36 | +- (CGFloat)imageHeight { | |
| 37 | + if (SCREEN_WIDTH == 320.0) { | |
| 38 | + return 62.5; | |
| 39 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 40 | + return 73.0; | |
| 41 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 42 | + return 81.0; | |
| 43 | + } | |
| 44 | + | |
| 45 | + return SCREEN_WIDTH*0.3*146/224; | |
| 46 | +} | |
| 47 | + | |
| 48 | +- (CGFloat)imageMargin { | |
| 49 | + if (SCREEN_WIDTH == 320.0) { | |
| 50 | + return 8.0; | |
| 51 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 52 | + return 10.0; | |
| 53 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 54 | + return 11.0; | |
| 55 | + } | |
| 56 | + | |
| 57 | + return 10.0; | |
| 58 | +} | |
| 59 | + | |
| 60 | +- (CGFloat)titleMargin { | |
| 61 | + if (SCREEN_WIDTH == 320.0) { | |
| 62 | + return 24.0; | |
| 63 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 64 | + return 28.0; | |
| 65 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 66 | + return 31.0; | |
| 67 | + } | |
| 68 | + | |
| 69 | + return 28.0; | |
| 70 | +} | |
| 71 | + | |
| 72 | +- (CGFloat)subtitleMargin | |
| 73 | +{ | |
| 74 | + if (SCREEN_WIDTH == 320.0) { | |
| 75 | + return 48.0; | |
| 76 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 77 | + return 55.0; | |
| 78 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 79 | + return 60.0; | |
| 80 | + } | |
| 81 | + | |
| 82 | + return 53.0; | |
| 83 | +} | |
| 84 | + | |
| 85 | +- (CGFloat)titleFontSize | |
| 86 | +{ | |
| 87 | + if (SCREEN_WIDTH == 320.0) { | |
| 88 | + return 14.0; | |
| 89 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 90 | + return 17.0; | |
| 91 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 92 | + return 19.0; | |
| 93 | + } | |
| 94 | + | |
| 95 | + return 17.0; | |
| 96 | +} | |
| 97 | + | |
| 98 | +- (CGFloat)subtitleFontSize | |
| 99 | +{ | |
| 100 | + if (SCREEN_WIDTH == 320.0) { | |
| 101 | + return 12.0; | |
| 102 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 103 | + return 14.0; | |
| 104 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 105 | + return 15.0; | |
| 106 | + } | |
| 107 | + | |
| 108 | + return 14.0; | |
| 109 | +} | |
| 110 | + | |
| 111 | +- (CGFloat)cellHeight | |
| 112 | +{ | |
| 113 | + if (SCREEN_WIDTH == 320.0) { | |
| 114 | + return 80.0; | |
| 115 | + } else if (SCREEN_WIDTH == 375.0) { | |
| 116 | + return 93.0; | |
| 117 | + } else if (SCREEN_WIDTH == 414.0) { | |
| 118 | + return 103.0; | |
| 119 | + } | |
| 120 | + return 93.0; | |
| 121 | +} | |
| 122 | + | |
| 123 | +#pragma mark | |
| 124 | +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | |
| 125 | +{ | |
| 126 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
| 127 | + if (self) { | |
| 128 | + self.selectionStyle = UITableViewCellSelectionStyleNone; | |
| 129 | + [self.contentView addSubview:self.imgView]; | |
| 130 | + [self.contentView addSubview:self.titleLab]; | |
| 131 | + [self.contentView addSubview:self.desLab]; | |
| 132 | + } | |
| 133 | + return self; | |
| 134 | +} | |
| 135 | + | |
| 136 | +-(UIImageView*)imgView | |
| 137 | +{ | |
| 138 | + if (!_imgView) { | |
| 139 | + | |
| 140 | + _imgView=[[UIImageView alloc] initWithFrame:CGRectMake(10, [self imageMargin], [self imageWidth], [self imageHeight])]; | |
| 141 | + } | |
| 142 | + return _imgView; | |
| 143 | +} | |
| 144 | + | |
| 145 | +-(UILabel*)titleLab | |
| 146 | +{ | |
| 147 | + if (!_titleLab) { | |
| 148 | + _titleLab=[[UILabel alloc] initWithFrame:CGRectMake([self imageWidth]+20.0, [self titleMargin], SCREEN_WIDTH-[self imageWidth]-30, [self titleFontSize])]; | |
| 149 | + _titleLab.textColor=[UIColor blackColorZX]; | |
| 150 | + _titleLab.font=[UIFont systemFontOfSize:[self titleFontSize]]; | |
| 151 | + } | |
| 152 | + return _titleLab; | |
| 153 | +} | |
| 154 | + | |
| 155 | +-(UILabel*)desLab | |
| 156 | +{ | |
| 157 | + if (!_desLab) { | |
| 158 | + _desLab=[[UILabel alloc] initWithFrame:CGRectMake([self imageWidth]+20.0, [self subtitleMargin], SCREEN_WIDTH-[self imageWidth]-30, [self subtitleFontSize])]; | |
| 159 | + _desLab.textColor=[UIColor colorWithHexString:@"#969797"]; | |
| 160 | + _desLab.font=[UIFont systemFontOfSize:[self subtitleFontSize]]; | |
| 161 | + _desLab.numberOfLines=0; | |
| 162 | + } | |
| 163 | + return _desLab; | |
| 164 | +} | |
| 165 | + | |
| 166 | +- (void)setModel:(LVCProgramModel *)model | |
| 167 | +{ | |
| 168 | + self.titleLab.text=model.title; | |
| 169 | + self.desLab.text=model.subTitle; | |
| 170 | + if (model.img) { | |
| 171 | + | |
| 172 | + [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"load_03"]]; | |
| 173 | + } | |
| 174 | +} | |
| 175 | + | |
| 176 | +- (void)awakeFromNib { | |
| 177 | + [super awakeFromNib]; | |
| 178 | + // Initialization code | |
| 179 | +} | |
| 180 | + | |
| 181 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | |
| 182 | + [super setSelected:selected animated:animated]; | |
| 183 | + | |
| 184 | + // Configure the view for the selected state | |
| 185 | +} | |
| 186 | + | |
| 187 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCOtherHeaderReusableView.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCOtherHeaderCollectionReusableView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "LVCChannelDetailsModel.h" | |
| 11 | +#import "LVCChannelsModel.h" | |
| 12 | + | |
| 13 | +@interface LVCOtherHeaderReusableView : UICollectionReusableView | |
| 14 | + | |
| 15 | +@property (nonatomic, strong) LVCChannelsModel *model; | |
| 16 | + | |
| 17 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCOtherHeaderReusableView.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCOtherHeaderCollectionReusableView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCOtherHeaderReusableView.h" | |
| 10 | +#import "LVCMoreProgramViewController.h" | |
| 11 | + | |
| 12 | +@interface LVCOtherHeaderReusableView () | |
| 13 | + | |
| 14 | +@property (nonatomic, strong)UIButton *button; | |
| 15 | +@property (nonatomic, strong)UIView *intervalView; | |
| 16 | +@property (nonatomic, strong)UIImageView *arrow; | |
| 17 | + | |
| 18 | +@end | |
| 19 | + | |
| 20 | +@implementation LVCOtherHeaderReusableView | |
| 21 | + | |
| 22 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 23 | +{ | |
| 24 | + self = [super initWithFrame:frame]; | |
| 25 | + if (self) { | |
| 26 | + [self setupUI]; | |
| 27 | + } | |
| 28 | + return self; | |
| 29 | +} | |
| 30 | + | |
| 31 | +- (void)setModel:(LVCChannelsModel *)model { | |
| 32 | + | |
| 33 | + _model = model; | |
| 34 | + [self.button setTitle:[NSString stringWithFormat:@" %@", model.title] forState:UIControlStateNormal]; | |
| 35 | +} | |
| 36 | + | |
| 37 | +- (UIButton *)button | |
| 38 | +{ | |
| 39 | + if (!_button) { | |
| 40 | + _button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 41 | + _button.frame = CGRectMake(0, 6, self.frame.size.width, 47); | |
| 42 | + [_button setTitleColor:[UIColor blackColorZX] forState:UIControlStateNormal]; | |
| 43 | + _button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | |
| 44 | + [_button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 45 | + _button.titleLabel.font = [UIFont boldSystemFontOfSize:18]; | |
| 46 | + } | |
| 47 | + return _button; | |
| 48 | +} | |
| 49 | + | |
| 50 | +- (UIImageView *)arrow | |
| 51 | +{ | |
| 52 | + if (!_arrow) { | |
| 53 | + _arrow = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-5-15, 19, 15, 21)]; | |
| 54 | + _arrow.image = [UIImage imageNamed:@"gengduo"]; | |
| 55 | + } | |
| 56 | + return _arrow; | |
| 57 | +} | |
| 58 | + | |
| 59 | +#pragma mark - Action | |
| 60 | +- (void)buttonAction | |
| 61 | +{ | |
| 62 | + LVCMoreProgramViewController *more = [[LVCMoreProgramViewController alloc]init]; | |
| 63 | + more.cid = _model.cid; | |
| 64 | + more.title = _model.title; | |
| 65 | + [self.viewController.navigationController pushViewController:more animated:YES]; | |
| 66 | +} | |
| 67 | + | |
| 68 | +#pragma mark - 设置组头界面 | |
| 69 | +- (void)setupUI | |
| 70 | +{ | |
| 71 | + | |
| 72 | + self.backgroundColor = [UIColor whiteColor]; | |
| 73 | + | |
| 74 | + UIView *intervalView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 6)]; | |
| 75 | + intervalView.backgroundColor = [UIColor backgroundColorZX]; | |
| 76 | + [self addSubview:intervalView]; | |
| 77 | + | |
| 78 | + [self addSubview:self.button]; | |
| 79 | + | |
| 80 | + [self addSubview:self.arrow]; | |
| 81 | +} | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.h
| ... | ... | @@ -20,15 +20,19 @@ |
| 20 | 20 | |
| 21 | 21 | @end |
| 22 | 22 | |
| 23 | +typedef void(^HideInputViewBlock)(BOOL hide); | |
| 23 | 24 | |
| 24 | 25 | @interface LVCPlayer : UIView |
| 25 | 26 | |
| 27 | +@property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 | |
| 28 | +@property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 | |
| 29 | +@property (nonatomic, readwrite, assign) BOOL isFullScreen; //是否是全屏 | |
| 30 | +@property (nonatomic, copy) HideInputViewBlock hideBlock; //全屏模式下是否隐藏输入框 | |
| 31 | + | |
| 26 | 32 | @property (nonatomic, assign) id<LVCPlayerDelegate> delegate; |
| 27 | 33 | |
| 28 | -@property (nonatomic, strong) UIImageView *contentView; //所有空间统一管理在这个view中 | |
| 29 | -@property (nonatomic, strong) UIButton *backBtn; //返回 | |
| 30 | -@property (nonatomic, readwrite, assign) BOOL isFullScreen; //是否是全屏 | |
| 34 | +- (void)autoHideControlView; //自动隐藏上下功能条 | |
| 31 | 35 | |
| 32 | -- (void)stopPlaying; | |
| 36 | +- (void)stopPlaying; //停止播放 | |
| 33 | 37 | |
| 34 | 38 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.m
| ... | ... | @@ -16,8 +16,8 @@ |
| 16 | 16 | |
| 17 | 17 | @interface LVCPlayer ()<UIGestureRecognizerDelegate> |
| 18 | 18 | |
| 19 | -@property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 | |
| 20 | -@property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 | |
| 19 | +@property (nonatomic, strong) UIButton *backBtn; //返回 | |
| 20 | +@property (nonatomic, strong) UIImageView *contentView; //所有空间统一管理在这个view中 | |
| 21 | 21 | @property (nonatomic, strong) UIButton *playOrPauseBtn; //播放/暂停 |
| 22 | 22 | @property (nonatomic, strong) UILabel *titleLab; //标题 |
| 23 | 23 | @property (nonatomic, strong) UIButton *fullScreenBtn; //控制全屏按钮 |
| ... | ... | @@ -26,6 +26,8 @@ |
| 26 | 26 | @property (nonatomic, strong) CNLiveMoviePlayerController *player; |
| 27 | 27 | @property (nonatomic, strong) SevenSwitch *barrageSwitch; //弹幕开关 |
| 28 | 28 | @property (nonatomic, strong) UIButton *editBtn; //全屏编辑按钮 |
| 29 | + | |
| 30 | +@property (nonatomic, strong) NSTimer *timer; //控制上下工具条定时器 | |
| 29 | 31 | @end |
| 30 | 32 | |
| 31 | 33 | @implementation LVCPlayer |
| ... | ... | @@ -108,31 +110,73 @@ |
| 108 | 110 | |
| 109 | 111 | } |
| 110 | 112 | |
| 113 | +- (void)barrageSwitchAction | |
| 114 | +{ | |
| 115 | + NSString *string = self.barrageSwitch.on ? @"已开启弹幕" : @"已关闭弹幕"; | |
| 116 | + | |
| 117 | + NSLog(@"%@",string); | |
| 118 | +} | |
| 119 | + | |
| 120 | +- (void)editBtnAction:(UIButton *)btn | |
| 121 | +{ | |
| 122 | + if (self.hideBlock) { | |
| 123 | + self.hideBlock(NO); | |
| 124 | + } | |
| 125 | + | |
| 126 | + [self hideControlView]; | |
| 127 | + | |
| 128 | + if (self.delegate && [self.delegate respondsToSelector:@selector(lvcPlayer:clickedEditBtn:)]) { | |
| 129 | + [self.delegate lvcPlayer:self clickedEditBtn:btn]; | |
| 130 | + } | |
| 131 | +} | |
| 132 | + | |
| 133 | + | |
| 111 | 134 | - (void)singleTapView |
| 112 | 135 | { |
| 113 | 136 | [UIView animateWithDuration:0.25 animations:^{ |
| 114 | - self.topBgView.alpha = self.topBgView.alpha == 0 ? 1 : 0; | |
| 115 | - self.bottomBgView.alpha = self.bottomBgView.alpha == 0 ? 1 : 0; | |
| 116 | - self.editBtn.alpha = self.editBtn.alpha == 0 ? 1 : 0; | |
| 137 | + _topBgView.alpha = _topBgView.alpha == 0 ? 1 : 0; | |
| 138 | + _bottomBgView.alpha = _bottomBgView.alpha == 0 ? 1 : 0; | |
| 139 | + _editBtn.alpha = _editBtn.alpha == 0 ? 1 : 0; | |
| 117 | 140 | }]; |
| 118 | 141 | |
| 142 | + [self autoHideControlView]; | |
| 143 | + | |
| 119 | 144 | if (_isFullScreen) { |
| 120 | 145 | [[UIApplication sharedApplication] setStatusBarHidden:self.topBgView.alpha == 0 ? YES : NO withAnimation:UIStatusBarAnimationFade]; |
| 146 | + if (self.hideBlock) { | |
| 147 | + self.hideBlock(YES); | |
| 148 | + } | |
| 121 | 149 | } |
| 122 | - | |
| 150 | + | |
| 123 | 151 | } |
| 124 | 152 | |
| 125 | -- (void)barrageSwitchAction | |
| 153 | +- (void)autoHideControlView | |
| 126 | 154 | { |
| 127 | - NSString *string = self.barrageSwitch.on ? @"已开启弹幕" : @"已关闭弹幕"; | |
| 128 | - | |
| 129 | - NSLog(@"%@",string); | |
| 155 | + if (!_timer) { | |
| 156 | + _timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(hideControlView) userInfo:nil repeats:NO]; | |
| 157 | + } else { | |
| 158 | + [NSObject cancelPreviousPerformRequestsWithTarget:self]; | |
| 159 | + [_timer invalidate]; | |
| 160 | + _timer = nil; | |
| 161 | + } | |
| 130 | 162 | } |
| 131 | 163 | |
| 132 | -- (void)editBtnAction:(UIButton *)btn | |
| 164 | +- (void)hideControlView | |
| 133 | 165 | { |
| 134 | - if (self.delegate && [self.delegate respondsToSelector:@selector(lvcPlayer:clickedEditBtn:)]) { | |
| 135 | - [self.delegate lvcPlayer:self clickedEditBtn:btn]; | |
| 166 | + | |
| 167 | + [UIView animateWithDuration:0.25 animations:^{ | |
| 168 | + _topBgView.alpha = 0; | |
| 169 | + _bottomBgView.alpha = 0; | |
| 170 | + _editBtn.alpha = 0; | |
| 171 | + }]; | |
| 172 | + | |
| 173 | + if (_isFullScreen) { | |
| 174 | + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; | |
| 175 | + } | |
| 176 | + | |
| 177 | + if (_timer) { | |
| 178 | + [_timer invalidate]; | |
| 179 | + _timer = nil; | |
| 136 | 180 | } |
| 137 | 181 | } |
| 138 | 182 | |
| ... | ... | @@ -305,6 +349,12 @@ |
| 305 | 349 | [_player stop]; |
| 306 | 350 | } |
| 307 | 351 | _player = nil; |
| 352 | + | |
| 353 | + if (_timer) { | |
| 354 | + [_timer invalidate]; | |
| 355 | + _timer = nil; | |
| 356 | + } | |
| 357 | + | |
| 308 | 358 | [self removeMovieNotificationObservers]; |
| 309 | 359 | } |
| 310 | 360 | |
| ... | ... | @@ -349,7 +399,7 @@ |
| 349 | 399 | }]; |
| 350 | 400 | |
| 351 | 401 | [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 352 | - make.left.equalTo(self.topBgView).with.offset(5); | |
| 402 | + make.left.equalTo(self.topBgView).with.offset(10); | |
| 353 | 403 | make.width.height.mas_equalTo(30); |
| 354 | 404 | make.top.equalTo(self.topBgView).with.offset(10); |
| 355 | 405 | }]; | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCTelevisionView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by iOS on 17/3/27. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCTelevisionView.h" | |
| 10 | +#import "LVCLiveListCollectionViewCell.h" | |
| 11 | +#import "LVCFirstHeaderReusableView.h" | |
| 12 | +#import "LVCOtherHeaderReusableView.h" | |
| 13 | +#import "LVCChannelDetailsModel.h" | |
| 14 | +#import "LVCChannelsModel.h" | |
| 15 | +#import "LVCBannerModel.h" | |
| 16 | + | |
| 17 | +static NSString *cellId = @"LVCLiveListCollectionViewCell"; | |
| 18 | +static NSString *firstHeaderId = @"LVCFirstHeaderReusableView"; | |
| 19 | +static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; | |
| 20 | + | |
| 21 | +@interface LVCTelevisionView ()<UICollectionViewDelegate,UICollectionViewDataSource> | |
| 22 | +{ | |
| 23 | + long long _timestamp; | |
| 24 | + NSTimer *_autoRefreshTimer; | |
| 25 | + CGFloat _refreshTime; | |
| 26 | + NSNotification *_liveNotification; | |
| 27 | + BOOL _adImageHidden; //开机广告或引导页是否显示完毕 | |
| 28 | +} | |
| 29 | + | |
| 30 | +@property (nonatomic, strong) UICollectionView *collectionView; | |
| 31 | +@property (nonatomic, strong) NSArray *bannerModelArray; //banner数据源 | |
| 32 | +@property (nonatomic, strong) NSArray *marqueeModelArray; // | |
| 33 | +@property (nonatomic, strong) NSArray *channelsModelArray; // | |
| 34 | +@property (nonatomic, strong) UIButton *reloadBtn; // 刷新按钮 | |
| 35 | +@property (nonatomic, strong) UILabel *reloadLab; // 刷新提示文字 | |
| 36 | +@property (nonatomic, strong) UIImageView *reloadImg; //刷新图片 | |
| 37 | + | |
| 38 | +@end | |
| 39 | + | |
| 40 | +@implementation LVCTelevisionView | |
| 41 | + | |
| 42 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 43 | +{ | |
| 44 | + self = [super initWithFrame:frame]; | |
| 45 | + if (self) { | |
| 46 | + | |
| 47 | + self.backgroundColor = [UIColor lightGrayColor]; | |
| 48 | + | |
| 49 | + [self loadData]; | |
| 50 | + | |
| 51 | +// _timestamp = [[self timestamp] longLongValue]; | |
| 52 | +// if (_refreshTime != 0) { | |
| 53 | +// _autoRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:_refreshTime target:self selector:@selector(autoRefresh) userInfo:nil repeats:YES]; | |
| 54 | +// } | |
| 55 | + | |
| 56 | + [self addSubview:self.collectionView]; | |
| 57 | + [self.collectionView.header beginRefreshing]; | |
| 58 | + | |
| 59 | + | |
| 60 | + } | |
| 61 | + return self; | |
| 62 | +} | |
| 63 | + | |
| 64 | +#pragma mark - action | |
| 65 | +- (void)reloadBtnAction | |
| 66 | +{ | |
| 67 | + // [self.reloadBtn removeFromSuperview]; | |
| 68 | + // [self.collectionView.header beginRefreshing]; | |
| 69 | + [self refresh]; | |
| 70 | +} | |
| 71 | + | |
| 72 | +- (void)refresh | |
| 73 | +{ | |
| 74 | + [self.reloadBtn removeFromSuperview]; | |
| 75 | + [self loadData]; | |
| 76 | +} | |
| 77 | + | |
| 78 | +- (void)isNeedToRefresh | |
| 79 | +{ | |
| 80 | + if (_refreshTime != 0) { | |
| 81 | + [_autoRefreshTimer invalidate]; | |
| 82 | + _autoRefreshTimer = nil; | |
| 83 | + _autoRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:_refreshTime target:self selector:@selector(autoRefresh) userInfo:nil repeats:YES]; | |
| 84 | + } | |
| 85 | + long long timestamp = [[self timestamp] longLongValue]; | |
| 86 | + if (timestamp-_timestamp > 180000) { | |
| 87 | + [self.collectionView.header beginRefreshing]; | |
| 88 | + } | |
| 89 | +} | |
| 90 | + | |
| 91 | +- (void)autoRefresh | |
| 92 | +{ | |
| 93 | + [self.collectionView.header beginRefreshing]; | |
| 94 | + [self loadData]; | |
| 95 | +} | |
| 96 | + | |
| 97 | +- (void)stopAutoRefresh | |
| 98 | +{ | |
| 99 | + [_autoRefreshTimer invalidate]; | |
| 100 | + _autoRefreshTimer = nil; | |
| 101 | +} | |
| 102 | + | |
| 103 | +#pragma mark - UICollectionViewDataSource | |
| 104 | +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { | |
| 105 | + if (self.channelsModelArray.count > 0) { | |
| 106 | + return self.channelsModelArray.count + 1; | |
| 107 | + } | |
| 108 | + return self.channelsModelArray.count; | |
| 109 | +} | |
| 110 | + | |
| 111 | +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | |
| 112 | + | |
| 113 | + if (section == 0) { | |
| 114 | + return 0; | |
| 115 | + } | |
| 116 | + LVCChannelsModel *model = self.channelsModelArray[section - 1]; | |
| 117 | + | |
| 118 | + NSArray *array = model.programs; | |
| 119 | + | |
| 120 | + return array.count; | |
| 121 | +} | |
| 122 | + | |
| 123 | +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
| 124 | + | |
| 125 | + LVCLiveListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; | |
| 126 | + | |
| 127 | + cell.backgroundColor = [UIColor lightGrayColor]; | |
| 128 | + | |
| 129 | + LVCChannelsModel *model = _channelsModelArray[indexPath.section - 1]; | |
| 130 | + | |
| 131 | + LVCChannelDetailsModel *details = model.programs[indexPath.item]; | |
| 132 | + | |
| 133 | + cell.details = details; | |
| 134 | + | |
| 135 | + return cell; | |
| 136 | +} | |
| 137 | + | |
| 138 | +- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { | |
| 139 | + | |
| 140 | + if (kind == UICollectionElementKindSectionHeader) { | |
| 141 | + | |
| 142 | + if (indexPath.section == 0) { | |
| 143 | + | |
| 144 | + LVCFirstHeaderReusableView *firstHeaderView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:firstHeaderId forIndexPath:indexPath]; | |
| 145 | + | |
| 146 | + firstHeaderView.imageUrls = [self bannerImage]; | |
| 147 | + firstHeaderView.modelArray = self.bannerModelArray; | |
| 148 | + | |
| 149 | + return firstHeaderView; | |
| 150 | + } else { | |
| 151 | + | |
| 152 | + LVCOtherHeaderReusableView *otherHeaderView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:otherHeaderId forIndexPath:indexPath]; | |
| 153 | + | |
| 154 | + LVCChannelsModel *model = _channelsModelArray[indexPath.section - 1]; | |
| 155 | + | |
| 156 | + otherHeaderView.model = model; | |
| 157 | + | |
| 158 | + return otherHeaderView; | |
| 159 | + } | |
| 160 | + } | |
| 161 | + return nil; | |
| 162 | +} | |
| 163 | + | |
| 164 | +- (NSArray <NSURL *>*)bannerImage { | |
| 165 | + | |
| 166 | + NSMutableArray *arrayM = [NSMutableArray array]; | |
| 167 | + for (LVCBannerModel *model in _bannerModelArray) { | |
| 168 | + NSString *imgStr = model.img; | |
| 169 | + NSURL *url = [NSURL URLWithString:imgStr]; | |
| 170 | + [arrayM addObject:url]; | |
| 171 | + } | |
| 172 | + return arrayM.copy; | |
| 173 | +} | |
| 174 | + | |
| 175 | +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { | |
| 176 | + | |
| 177 | + if (section == 0) { | |
| 178 | + return CGSizeMake(SCREEN_WIDTH, SCREEN_WIDTH * 0.5); | |
| 179 | + }else { | |
| 180 | + return CGSizeMake(SCREEN_WIDTH, 47); | |
| 181 | + } | |
| 182 | +} | |
| 183 | + | |
| 184 | +#pragma mark - UICollectionViewDelegate | |
| 185 | +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { | |
| 186 | + NSLog(@"跳转-----"); | |
| 187 | + | |
| 188 | +} | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | +#pragma mark - 加载数据 | |
| 193 | +- (void)loadData { | |
| 194 | + | |
| 195 | + NSDictionary *parameter = @{@"cid": @"zb/", | |
| 196 | + @"plat":@"i", | |
| 197 | + @"appid":@"spzg", | |
| 198 | + @"version":@"1"}; | |
| 199 | + | |
| 200 | + [[AFHTTPSessionManager manager] GET:@"http://app.jczb.cnlive.com/api/appindex?appid=spzg&cid=zb%2F&plat=i&version=1" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { | |
| 201 | + _timestamp = [[self timestamp] longLongValue]; | |
| 202 | +// if (_refreshTime != 0) { | |
| 203 | +// [_autoRefreshTimer invalidate]; | |
| 204 | +// _autoRefreshTimer = nil; | |
| 205 | +// _autoRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:_refreshTime target:self selector:@selector(autoRefresh) userInfo:nil repeats:YES]; | |
| 206 | +// } | |
| 207 | + | |
| 208 | + [self.collectionView.header endRefreshing]; | |
| 209 | + | |
| 210 | + if (responseObject[@"channels"] && [responseObject[@"channels"] isKindOfClass:[NSArray class]]) { | |
| 211 | + | |
| 212 | + NSMutableArray *arrayM = [[NSMutableArray alloc]init]; | |
| 213 | + for (NSDictionary *dict in responseObject[@"channels"]) { | |
| 214 | + LVCChannelsModel *model = [LVCChannelsModel new]; | |
| 215 | + [model setValuesForKeysWithDictionary:dict]; | |
| 216 | + [arrayM addObject:model]; | |
| 217 | + } | |
| 218 | + self.channelsModelArray = arrayM; | |
| 219 | + } | |
| 220 | + if (responseObject[@"banner"] && [responseObject[@"banner"] isKindOfClass:[NSArray class]]) { | |
| 221 | + | |
| 222 | + NSMutableArray *arrayM = [NSMutableArray array]; | |
| 223 | + for (NSDictionary *dict in responseObject[@"banner"]) { | |
| 224 | + LVCBannerModel *rollModel = [LVCBannerModel new]; | |
| 225 | + [rollModel setValuesForKeysWithDictionary:dict]; | |
| 226 | + [arrayM addObject:rollModel]; | |
| 227 | + } | |
| 228 | + self.bannerModelArray = arrayM; | |
| 229 | + } | |
| 230 | + self.collectionView.backgroundColor = [UIColor whiteColor]; | |
| 231 | + [self.collectionView reloadData]; | |
| 232 | + | |
| 233 | + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { | |
| 234 | + | |
| 235 | + NSLog(@"获取电视台数据失败"); | |
| 236 | + | |
| 237 | + }]; | |
| 238 | + | |
| 239 | + | |
| 240 | +} | |
| 241 | + | |
| 242 | +- (NSString *)timestamp { | |
| 243 | + | |
| 244 | + NSString *stamp = @""; | |
| 245 | + | |
| 246 | + stamp = [NSString stringWithFormat:@"%.3f", [[NSDate date] timeIntervalSince1970]]; | |
| 247 | + stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""]; | |
| 248 | + | |
| 249 | + return stamp; | |
| 250 | +} | |
| 251 | + | |
| 252 | + | |
| 253 | +#pragma mark - | |
| 254 | +#pragma mark - getter | |
| 255 | +- (UICollectionView *)collectionView { | |
| 256 | + | |
| 257 | + if (!_collectionView) { | |
| 258 | + | |
| 259 | + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; | |
| 260 | + layout.itemSize = CGSizeMake((SCREEN_WIDTH-30)/2, (SCREEN_WIDTH-30)/2*9/16+65); | |
| 261 | + layout.minimumLineSpacing = 0; | |
| 262 | + layout.minimumInteritemSpacing = 0; | |
| 263 | + layout.sectionInset = UIEdgeInsetsMake(6, 10, 0, 10); | |
| 264 | + _collectionView.showsHorizontalScrollIndicator = NO; | |
| 265 | + | |
| 266 | + _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) collectionViewLayout:layout]; | |
| 267 | + _collectionView.backgroundColor = [UIColor whiteColor]; | |
| 268 | + | |
| 269 | + [_collectionView registerClass:[LVCLiveListCollectionViewCell class] forCellWithReuseIdentifier:cellId]; | |
| 270 | + [_collectionView registerClass:[LVCFirstHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:firstHeaderId]; | |
| 271 | + [_collectionView registerClass:[LVCOtherHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:otherHeaderId]; | |
| 272 | + | |
| 273 | + _collectionView.dataSource = self; | |
| 274 | + _collectionView.delegate = self; | |
| 275 | + | |
| 276 | +// MJRefreshGifHeader *header = [CNRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(refresh)]; | |
| 277 | +// _collectionView.header = header; | |
| 278 | + } | |
| 279 | + return _collectionView; | |
| 280 | +} | |
| 281 | + | |
| 282 | +//- (UIButton *)reloadBtn | |
| 283 | +//{ | |
| 284 | +// if (!_reloadBtn) { | |
| 285 | +// _reloadBtn = [Tools getReloadBtn]; | |
| 286 | +// // _reloadBtn.backgroundColor = [UIColor brownColor]; | |
| 287 | +// _reloadBtn.x = (self.width-220)/2; | |
| 288 | +// _reloadBtn.y = (self.height-[Tools adapterReloadBtnHeight])/2-50; | |
| 289 | +// [_reloadBtn addTarget:self action:@selector(reloadBtnAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 290 | +// [_reloadBtn addSubview:self.reloadImg]; | |
| 291 | +// [_reloadBtn addSubview:self.reloadLab]; | |
| 292 | +// } | |
| 293 | +// return _reloadBtn; | |
| 294 | +//} | |
| 295 | + | |
| 296 | +//- (UILabel *)reloadLab | |
| 297 | +//{ | |
| 298 | +// if (!_reloadLab) { | |
| 299 | +// _reloadLab = [Tools getReloadLab]; | |
| 300 | +// } | |
| 301 | +// return _reloadLab; | |
| 302 | +//} | |
| 303 | +//- (UIImageView *)reloadImg | |
| 304 | +//{ | |
| 305 | +// if (!_reloadImg) { | |
| 306 | +// _reloadImg = [[UIImageView alloc] init]; | |
| 307 | +// // _reloadImg.backgroundColor = [UIColor redColor]; | |
| 308 | +// _reloadImg.frame = CGRectMake(_reloadBtn.width/2-[Tools adapterImgWidth]/2+10, 0, [Tools adapterImgWidth], [Tools adapterImgWidth]); | |
| 309 | +// } | |
| 310 | +// return _reloadImg; | |
| 311 | +//} | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | +/* | |
| 316 | +// Only override drawRect: if you perform custom drawing. | |
| 317 | +// An empty implementation adversely affects performance during animation. | |
| 318 | +- (void)drawRect:(CGRect)rect { | |
| 319 | + // Drawing code | |
| 320 | +} | |
| 321 | +*/ | |
| 322 | + | |
| 323 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/PrefixHeader.pch
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | #import "SVProgressHUD.h" |
| 25 | 25 | #import "AFNetworking.h" |
| 26 | 26 | #import "Masonry.h" |
| 27 | + #import "UIView+ViewController.h" | |
| 27 | 28 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> |
| 28 | 29 | #import <CNLiveMsgTools/CNLiveMsgManager.h> |
| 29 | 30 | #import <CNLiveChatManager/CNLiveChatManager.h> | ... | ... |
LiveVideoCloud/LiveVideoCloud/UtilKits/Category/UIView+ViewController.h
0 → 100755
LiveVideoCloud/LiveVideoCloud/UtilKits/Category/UIView+ViewController.m
0 → 100755
| 1 | +// | |
| 2 | +// UIView+ViewController.m | |
| 3 | +// CNLive | |
| 4 | +// | |
| 5 | +// Created by 雷浩杰 on 15/9/1. | |
| 6 | +// Copyright (c) 2015年 雷浩杰. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "UIView+ViewController.h" | |
| 10 | + | |
| 11 | +@implementation UIView (ViewController) | |
| 12 | + | |
| 13 | +- (UIViewController *)viewController { | |
| 14 | + UIResponder *next = self.nextResponder; | |
| 15 | + | |
| 16 | + do { | |
| 17 | + //判断响应者是否为视图控制器 | |
| 18 | + if ([next isKindOfClass:[UIViewController class]]) { | |
| 19 | + return (UIViewController *)next; | |
| 20 | + } | |
| 21 | + | |
| 22 | + next = next.nextResponder; | |
| 23 | + } while (next != nil); | |
| 24 | + | |
| 25 | + return nil; | |
| 26 | +} | |
| 27 | + | |
| 28 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/Gift box.imageset/Contents.json
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/gengduo.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "scale" : "2x" | |
| 10 | + }, | |
| 11 | + { | |
| 12 | + "idiom" : "universal", | |
| 13 | + "filename" : "gengduo.png", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/gengduo.imageset/gengduo.png
0 → 100644
1.32 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/load_03-1.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "load_03.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/load_03-1.imageset/load_03.png
0 → 100644
3.63 KB