Commit d5520be16d0054cb105c235980b13c911ba87f78
1 parent
3758957d
假数据推荐页
Showing
14 changed files
with
706 additions
and
9 deletions
LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -215,11 +215,16 @@ |
| 215 | 215 | D23BBDBB1EF8E8B2002FE0B8 /* LVCBannerAndMarqueeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D23BBDBA1EF8E8B2002FE0B8 /* LVCBannerAndMarqueeModel.m */; }; |
| 216 | 216 | D23BBDBE1EF8ED4A002FE0B8 /* LVCChannelDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D23BBDBD1EF8ED4A002FE0B8 /* LVCChannelDetailModel.m */; }; |
| 217 | 217 | D23BBDC11EF8F513002FE0B8 /* LVCBqWqXgModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D23BBDC01EF8F513002FE0B8 /* LVCBqWqXgModel.m */; }; |
| 218 | + D23BBDC41EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D23BBDC31EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.m */; }; | |
| 219 | + D23BBDC71EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D23BBDC61EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m */; }; | |
| 218 | 220 | D23DC1551ECC41C100103B0E /* LVCVerifyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D23DC1541ECC41C100103B0E /* LVCVerifyViewController.m */; }; |
| 219 | 221 | D24571581E8393EB00AA85D6 /* UIImageView+ZXExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = D24571571E8393EB00AA85D6 /* UIImageView+ZXExtension.m */; }; |
| 220 | 222 | D245715C1E83A62B00AA85D6 /* BounceView.m in Sources */ = {isa = PBXBuildFile; fileRef = D245715B1E83A62B00AA85D6 /* BounceView.m */; }; |
| 221 | 223 | D245715F1E83B09900AA85D6 /* userInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D245715E1E83B09900AA85D6 /* userInfoModel.m */; }; |
| 222 | 224 | D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */ = {isa = PBXBuildFile; fileRef = D24571621E83C40B00AA85D6 /* PrivateView.m */; }; |
| 225 | + D24CFC201EFA092300AA6ADB /* JBBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D24CFC1F1EFA092300AA6ADB /* JBBannerView.m */; }; | |
| 226 | + D24F40921EFB727000833738 /* JBAutoRollTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D24F40911EFB727000833738 /* JBAutoRollTableView.m */; }; | |
| 227 | + D24F40951EFB965A00833738 /* JBSearchView.m in Sources */ = {isa = PBXBuildFile; fileRef = D24F40941EFB965A00833738 /* JBSearchView.m */; }; | |
| 223 | 228 | D25530001E7909AC00DF38A5 /* GiftAnimOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2552FFF1E7909AC00DF38A5 /* GiftAnimOperation.m */; }; |
| 224 | 229 | D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D25530021E79115100DF38A5 /* AnimQueueManager.m */; }; |
| 225 | 230 | D25530061E7911A800DF38A5 /* GiftAnimationAction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25530051E7911A800DF38A5 /* GiftAnimationAction.m */; }; |
| ... | ... | @@ -735,6 +740,10 @@ |
| 735 | 740 | D23BBDBD1EF8ED4A002FE0B8 /* LVCChannelDetailModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChannelDetailModel.m; sourceTree = "<group>"; }; |
| 736 | 741 | D23BBDBF1EF8F513002FE0B8 /* LVCBqWqXgModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCBqWqXgModel.h; sourceTree = "<group>"; }; |
| 737 | 742 | D23BBDC01EF8F513002FE0B8 /* LVCBqWqXgModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCBqWqXgModel.m; sourceTree = "<group>"; }; |
| 743 | + D23BBDC21EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMainHorizontalCollectionViewCell.h; sourceTree = "<group>"; }; | |
| 744 | + D23BBDC31EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMainHorizontalCollectionViewCell.m; sourceTree = "<group>"; }; | |
| 745 | + D23BBDC51EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCSectionHeaderCollectionReusableView.h; sourceTree = "<group>"; }; | |
| 746 | + D23BBDC61EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCSectionHeaderCollectionReusableView.m; sourceTree = "<group>"; }; | |
| 738 | 747 | D23DC1531ECC41C100103B0E /* LVCVerifyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCVerifyViewController.h; sourceTree = "<group>"; }; |
| 739 | 748 | D23DC1541ECC41C100103B0E /* LVCVerifyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCVerifyViewController.m; sourceTree = "<group>"; }; |
| 740 | 749 | D24571561E8393EB00AA85D6 /* UIImageView+ZXExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+ZXExtension.h"; sourceTree = "<group>"; }; |
| ... | ... | @@ -745,6 +754,12 @@ |
| 745 | 754 | D245715E1E83B09900AA85D6 /* userInfoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = userInfoModel.m; sourceTree = "<group>"; }; |
| 746 | 755 | D24571611E83C40B00AA85D6 /* PrivateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateView.h; sourceTree = "<group>"; }; |
| 747 | 756 | D24571621E83C40B00AA85D6 /* PrivateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrivateView.m; sourceTree = "<group>"; }; |
| 757 | + D24CFC1E1EFA092300AA6ADB /* JBBannerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBBannerView.h; sourceTree = "<group>"; }; | |
| 758 | + D24CFC1F1EFA092300AA6ADB /* JBBannerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBBannerView.m; sourceTree = "<group>"; }; | |
| 759 | + D24F40901EFB727000833738 /* JBAutoRollTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBAutoRollTableView.h; sourceTree = "<group>"; }; | |
| 760 | + D24F40911EFB727000833738 /* JBAutoRollTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBAutoRollTableView.m; sourceTree = "<group>"; }; | |
| 761 | + D24F40931EFB965A00833738 /* JBSearchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBSearchView.h; sourceTree = "<group>"; }; | |
| 762 | + D24F40941EFB965A00833738 /* JBSearchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBSearchView.m; sourceTree = "<group>"; }; | |
| 748 | 763 | D2552FFE1E7909AC00DF38A5 /* GiftAnimOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftAnimOperation.h; sourceTree = "<group>"; }; |
| 749 | 764 | D2552FFF1E7909AC00DF38A5 /* GiftAnimOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftAnimOperation.m; sourceTree = "<group>"; }; |
| 750 | 765 | D25530011E79115100DF38A5 /* AnimQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimQueueManager.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -1764,6 +1779,16 @@ |
| 1764 | 1779 | D214CB511EF7CB310014EEBA /* LVCChannelPagingView.m */, |
| 1765 | 1780 | D23BBDB61EF8D15D002FE0B8 /* LVCMainHeaderCollectionReusableView.h */, |
| 1766 | 1781 | D23BBDB71EF8D15D002FE0B8 /* LVCMainHeaderCollectionReusableView.m */, |
| 1782 | + D23BBDC51EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.h */, | |
| 1783 | + D23BBDC61EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m */, | |
| 1784 | + D23BBDC21EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.h */, | |
| 1785 | + D23BBDC31EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.m */, | |
| 1786 | + D24F40931EFB965A00833738 /* JBSearchView.h */, | |
| 1787 | + D24F40941EFB965A00833738 /* JBSearchView.m */, | |
| 1788 | + D24CFC1E1EFA092300AA6ADB /* JBBannerView.h */, | |
| 1789 | + D24CFC1F1EFA092300AA6ADB /* JBBannerView.m */, | |
| 1790 | + D24F40901EFB727000833738 /* JBAutoRollTableView.h */, | |
| 1791 | + D24F40911EFB727000833738 /* JBAutoRollTableView.m */, | |
| 1767 | 1792 | ); |
| 1768 | 1793 | name = View; |
| 1769 | 1794 | sourceTree = "<group>"; |
| ... | ... | @@ -2363,6 +2388,7 @@ |
| 2363 | 2388 | D2029CCE1E6EADE10027CD92 /* SearchRecomListModel.m in Sources */, |
| 2364 | 2389 | D2029CA11E6EADE10027CD92 /* NSString+MJExtension.m in Sources */, |
| 2365 | 2390 | 4B45CE7A1EB86A590079AFB7 /* MineLiveController.m in Sources */, |
| 2391 | + D24F40951EFB965A00833738 /* JBSearchView.m in Sources */, | |
| 2366 | 2392 | D2029BCB1E6EADD70027CD92 /* BaseTableViewCell.m in Sources */, |
| 2367 | 2393 | 81F1C8381E8BBDDA0085C2B8 /* MHPagingScrollView.m in Sources */, |
| 2368 | 2394 | D2029CAA1E6EADE10027CD92 /* MJRefreshBackGifFooter.m in Sources */, |
| ... | ... | @@ -2379,6 +2405,7 @@ |
| 2379 | 2405 | 4B45CEA61EB86B9F0079AFB7 /* NSNumber+ScaleHeight.m in Sources */, |
| 2380 | 2406 | 810B65031E779B1F00133E15 /* MASViewConstraint.m in Sources */, |
| 2381 | 2407 | D2029BCE1E6EADD70027CD92 /* ZXNavigationController.m in Sources */, |
| 2408 | + D23BBDC71EF8FBD1002FE0B8 /* LVCSectionHeaderCollectionReusableView.m in Sources */, | |
| 2382 | 2409 | 81A482F51E88ACC80097A80A /* LVCTelevisionView.m in Sources */, |
| 2383 | 2410 | D2F0486A1EE54E860011E39C /* LVCLiveActivityInfoService.m in Sources */, |
| 2384 | 2411 | D2029CA21E6EADE10027CD92 /* MJRefreshAutoFooter.m in Sources */, |
| ... | ... | @@ -2394,6 +2421,7 @@ |
| 2394 | 2421 | D2029CA61E6EADE10027CD92 /* MJRefreshHeader.m in Sources */, |
| 2395 | 2422 | D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */, |
| 2396 | 2423 | 4B45CE801EB86A590079AFB7 /* idAndPwdView.m in Sources */, |
| 2424 | + D23BBDC41EF8FB99002FE0B8 /* LVCMainHorizontalCollectionViewCell.m in Sources */, | |
| 2397 | 2425 | D233EE721EEA88EF00674ED5 /* LVCHomePageViewController.m in Sources */, |
| 2398 | 2426 | D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */, |
| 2399 | 2427 | 4BD8560A1EBACD530082061D /* UIWebView+AFNetworking.m in Sources */, |
| ... | ... | @@ -2404,6 +2432,7 @@ |
| 2404 | 2432 | D2029CC81E6EADE10027CD92 /* SVProgressAnimatedView.m in Sources */, |
| 2405 | 2433 | 4B45CE891EB86A590079AFB7 /* LVCPersonalImageCell.m in Sources */, |
| 2406 | 2434 | D2029C961E6EADE10027CD92 /* MBProgressHUD.m in Sources */, |
| 2435 | + D24F40921EFB727000833738 /* JBAutoRollTableView.m in Sources */, | |
| 2407 | 2436 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */, |
| 2408 | 2437 | D2029C9A1E6EADE10027CD92 /* MJProperty.m in Sources */, |
| 2409 | 2438 | 4BD856031EBACD530082061D /* AFNetworkActivityIndicatorManager.m in Sources */, |
| ... | ... | @@ -2501,6 +2530,7 @@ |
| 2501 | 2530 | D20C82BE1EEEA89700BB609F /* LVCHomePageListModel.m in Sources */, |
| 2502 | 2531 | 4B42A6C71EC0171800DA09D7 /* PlayRecordCell.m in Sources */, |
| 2503 | 2532 | D217A24E1E7B77C7003B44CB /* ComboCell.m in Sources */, |
| 2533 | + D24CFC201EFA092300AA6ADB /* JBBannerView.m in Sources */, | |
| 2504 | 2534 | D2029CBD1E6EADE10027CD92 /* SDWebImageManager.m in Sources */, |
| 2505 | 2535 | 811BB6881E8107B4005C6291 /* LVCChatViewTableViewCell.m in Sources */, |
| 2506 | 2536 | 811BB6801E80F858005C6291 /* LVCChatView.m in Sources */, | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBAutoRollTableView.h
0 → 100644
| 1 | +// | |
| 2 | +// JBAutoRollTableView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/22. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface JBAutoRollTableView : UITableView | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) NSArray *news; | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBAutoRollTableView.m
0 → 100644
| 1 | +// | |
| 2 | +// JBAutoRollTableView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/22. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "JBAutoRollTableView.h" | |
| 10 | + | |
| 11 | +@interface JBAutoRollTableView()<UITableViewDataSource, UITableViewDelegate> { | |
| 12 | + | |
| 13 | + NSTimer *_timer; | |
| 14 | + NSIndexPath *_currentIndexPath; | |
| 15 | +} | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +@implementation JBAutoRollTableView | |
| 20 | + | |
| 21 | +- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style | |
| 22 | +{ | |
| 23 | + self = [super initWithFrame:frame style:style]; | |
| 24 | + if (self) { | |
| 25 | + self.showsHorizontalScrollIndicator = NO; | |
| 26 | + self.showsVerticalScrollIndicator = NO; | |
| 27 | + self.delegate = self; | |
| 28 | + self.dataSource = self; | |
| 29 | + self.rowHeight = self.height; | |
| 30 | + self.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 31 | + self.scrollEnabled = NO; | |
| 32 | + self.scrollsToTop = NO; | |
| 33 | + } | |
| 34 | + return self; | |
| 35 | +} | |
| 36 | + | |
| 37 | +- (void)setNews:(NSArray *)news { | |
| 38 | + if (_news != news) { | |
| 39 | + _news = news; | |
| 40 | + [self reloadData]; | |
| 41 | + [_timer invalidate]; | |
| 42 | + _currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; | |
| 43 | + if (news.count > 1) { | |
| 44 | + _timer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(autoRollNews) userInfo:nil repeats:YES]; | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | |
| 48 | + | |
| 49 | +- (void)autoRollNews | |
| 50 | +{ | |
| 51 | + if (_news.count < 2) { | |
| 52 | + [_timer invalidate]; | |
| 53 | + _timer = nil; | |
| 54 | + return; | |
| 55 | + } | |
| 56 | + if (_currentIndexPath.row < _news.count-1) { | |
| 57 | + [self scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:_currentIndexPath.row + 1 inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; | |
| 58 | + _currentIndexPath = [NSIndexPath indexPathForRow:_currentIndexPath.row + 1 inSection:0]; | |
| 59 | + } else { | |
| 60 | + | |
| 61 | + NSMutableArray *array = [NSMutableArray arrayWithArray:_news]; | |
| 62 | + [array insertObject:[_news lastObject] atIndex:0]; | |
| 63 | + [array removeLastObject]; | |
| 64 | + _news = array; | |
| 65 | + [self reloadData]; | |
| 66 | + [self scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:NO]; | |
| 67 | + [self scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; | |
| 68 | + _currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0]; | |
| 69 | + } | |
| 70 | +} | |
| 71 | + | |
| 72 | +#pragma mark - UITableViewDataSource !!!!!!!!!!!!!!!!!!!! | |
| 73 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
| 74 | +{ | |
| 75 | + return _news.count; | |
| 76 | +} | |
| 77 | + | |
| 78 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| 79 | +{ | |
| 80 | + static NSString *identify = @"newsTableViewcell"; | |
| 81 | + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify]; | |
| 82 | + if (cell == nil) { | |
| 83 | + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify]; | |
| 84 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
| 85 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, self.height)]; | |
| 86 | + label.tag = 101; | |
| 87 | + label.textColor = [UIColor grayColorCNLive]; | |
| 88 | + label.font = [UIFont systemFontOfSize:14]; | |
| 89 | + [cell addSubview:label]; | |
| 90 | + } | |
| 91 | + ProgramModel *model = [_news safetyObjectAtIndex:indexPath.row]; | |
| 92 | + UILabel *label = (UILabel *)[cell viewWithTag:101]; | |
| 93 | + label.text = model.title; | |
| 94 | + return cell; | |
| 95 | +} | |
| 96 | + | |
| 97 | +#pragma mark - UITableViewDelegate !!!!!!!!!!!!!!!!!!!! | |
| 98 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 99 | + | |
| 100 | + [tableView deselectRowAtIndexPath:indexPath animated:YES]; | |
| 101 | +} | |
| 102 | + | |
| 103 | +- (void)removeFromSuperview { | |
| 104 | + [super removeFromSuperview]; | |
| 105 | + | |
| 106 | + [_timer invalidate]; | |
| 107 | + _timer = nil; | |
| 108 | +} | |
| 109 | + | |
| 110 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBBannerView.h
0 → 100644
| 1 | +// | |
| 2 | +// JBBannerView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/21. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +@class JBBannerView; | |
| 11 | + | |
| 12 | +@protocol JBBannerViewDelegate <NSObject> | |
| 13 | +@optional | |
| 14 | +- (void)didSelectedBannerView:(JBBannerView *)banner atIndex:(NSInteger)index; | |
| 15 | +@end | |
| 16 | + | |
| 17 | +@protocol JBBannerViewDatasource <NSObject> | |
| 18 | +@required | |
| 19 | +- (NSInteger)numberOfPages; | |
| 20 | +- (UIView *)pageAtIndex:(NSInteger)index; | |
| 21 | +@end | |
| 22 | + | |
| 23 | +@interface JBBannerView : UIView | |
| 24 | + | |
| 25 | +@property (nonatomic, weak) id <JBBannerViewDelegate> delegate; | |
| 26 | +@property (nonatomic, weak) id <JBBannerViewDatasource> datasource; | |
| 27 | + | |
| 28 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBBannerView.m
0 → 100644
| 1 | +// | |
| 2 | +// JBBannerView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/21. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "JBBannerView.h" | |
| 10 | + | |
| 11 | +#define kDataScaleSeed 100 | |
| 12 | + | |
| 13 | +@interface JBBannerView() <UICollectionViewDelegate, UICollectionViewDataSource> { | |
| 14 | + | |
| 15 | + NSTimer *_timer; | |
| 16 | + NSTimeInterval _timerDuration; | |
| 17 | +} | |
| 18 | + | |
| 19 | +@property (nonatomic, strong) UICollectionView *collectionView; | |
| 20 | +@property (nonatomic, strong) UILabel *cycleViewTitle; | |
| 21 | + | |
| 22 | +@end | |
| 23 | + | |
| 24 | +@implementation JBBannerView | |
| 25 | + | |
| 26 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 27 | +{ | |
| 28 | + self = [super initWithFrame:frame]; | |
| 29 | + if (self) { | |
| 30 | + _timerDuration = 3.0; | |
| 31 | + _timer = [NSTimer timerWithTimeInterval:_timerDuration target:self selector:@selector(updateTimer) userInfo:nil repeats:YES]; | |
| 32 | + [[NSRunLoop currentRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes]; | |
| 33 | + | |
| 34 | + [self addSubview:self.collectionView]; | |
| 35 | + [self addSubview:self.cycleViewTitle]; | |
| 36 | + } | |
| 37 | + return self; | |
| 38 | +} | |
| 39 | + | |
| 40 | +#pragma mark - 时钟方法 | |
| 41 | +- (void)updateTimer { | |
| 42 | + | |
| 43 | + NSIndexPath *indexPath = [_collectionView indexPathsForVisibleItems].lastObject; | |
| 44 | + NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:indexPath.item + 1 inSection:indexPath.section]; | |
| 45 | + | |
| 46 | + [_collectionView scrollToItemAtIndexPath:newIndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:YES]; | |
| 47 | +} | |
| 48 | + | |
| 49 | +#pragma mark - UICollectionViewDelegate !!!!!!!!!!!! | |
| 50 | +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { | |
| 51 | + | |
| 52 | + | |
| 53 | +} | |
| 54 | + | |
| 55 | +- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { | |
| 56 | + | |
| 57 | + [self scrollViewDidEndDecelerating:scrollView]; | |
| 58 | +} | |
| 59 | + | |
| 60 | +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { | |
| 61 | + | |
| 62 | + NSInteger page = scrollView.contentOffset.x / scrollView.bounds.size.width; | |
| 63 | + | |
| 64 | + self.cycleViewTitle.text = [NSString stringWithFormat:@" %ld",(long)(page % 3)]; | |
| 65 | + | |
| 66 | + NSInteger lastItem = [_collectionView numberOfItemsInSection:0]; | |
| 67 | + | |
| 68 | + if (page == 0 || page == (lastItem - 1)) { | |
| 69 | + | |
| 70 | + NSInteger offset = 3; | |
| 71 | + | |
| 72 | + if (page == (lastItem - 1)) { | |
| 73 | + offset = offset - 1; | |
| 74 | + } | |
| 75 | + | |
| 76 | + CGFloat width = scrollView.bounds.size.width; | |
| 77 | + | |
| 78 | + scrollView.contentOffset = CGPointMake(offset * width, 0); | |
| 79 | + } | |
| 80 | +} | |
| 81 | + | |
| 82 | +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
| 83 | + | |
| 84 | + _timer.fireDate = [NSDate distantFuture]; | |
| 85 | +} | |
| 86 | + | |
| 87 | +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { | |
| 88 | + | |
| 89 | + _timer.fireDate = [NSDate dateWithTimeIntervalSinceNow:_timerDuration]; | |
| 90 | +} | |
| 91 | + | |
| 92 | +#pragma mark - UICollectionViewDataSource !!!!!!!!!!!! | |
| 93 | +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | |
| 94 | + | |
| 95 | + return 6; | |
| 96 | +} | |
| 97 | + | |
| 98 | +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
| 99 | + | |
| 100 | + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collcellId" forIndexPath:indexPath]; | |
| 101 | + switch (indexPath.item) { | |
| 102 | + case 0: | |
| 103 | + cell.backgroundColor = [UIColor yellowColor]; | |
| 104 | + break; | |
| 105 | + case 1: | |
| 106 | + cell.backgroundColor = [UIColor greenColor]; | |
| 107 | + break; | |
| 108 | + case 2: | |
| 109 | + cell.backgroundColor = [UIColor blueColor]; | |
| 110 | + break; | |
| 111 | + case 3: | |
| 112 | + cell.backgroundColor = [UIColor yellowColor]; | |
| 113 | + break; | |
| 114 | + case 4: | |
| 115 | + cell.backgroundColor = [UIColor greenColor]; | |
| 116 | + break; | |
| 117 | + case 5: | |
| 118 | + cell.backgroundColor = [UIColor blueColor]; | |
| 119 | + break; | |
| 120 | + default: | |
| 121 | + break; | |
| 122 | + } | |
| 123 | + | |
| 124 | + return cell; | |
| 125 | +} | |
| 126 | + | |
| 127 | +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 128 | +- (UICollectionView *)collectionView { | |
| 129 | + | |
| 130 | + if (!_collectionView) { | |
| 131 | + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; | |
| 132 | + layout.minimumLineSpacing = 0; | |
| 133 | + layout.minimumInteritemSpacing = 0; | |
| 134 | + layout.itemSize = CGSizeMake(KScreenWidth-20, (KScreenWidth-20)/2); | |
| 135 | + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; | |
| 136 | + | |
| 137 | + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, 10, KScreenWidth-20, (KScreenWidth-20)/2) collectionViewLayout:layout]; | |
| 138 | + _collectionView.backgroundColor = [UIColor whiteColor]; | |
| 139 | + _collectionView.delegate = self; | |
| 140 | + _collectionView.dataSource = self; | |
| 141 | + _collectionView.pagingEnabled = YES; | |
| 142 | + _collectionView.showsVerticalScrollIndicator = NO; | |
| 143 | + _collectionView.showsHorizontalScrollIndicator = NO; | |
| 144 | + _collectionView.bounces = NO; | |
| 145 | + [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"collcellId"]; | |
| 146 | + } | |
| 147 | + return _collectionView; | |
| 148 | +} | |
| 149 | + | |
| 150 | +- (UILabel *)cycleViewTitle { | |
| 151 | + | |
| 152 | + if (!_cycleViewTitle) { | |
| 153 | + | |
| 154 | + _cycleViewTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, self.collectionView.bottom-35, self.collectionView.width, 35)]; | |
| 155 | + _cycleViewTitle.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; | |
| 156 | + _cycleViewTitle.textColor = [UIColor whiteColor]; | |
| 157 | + _cycleViewTitle.font = [UIFont systemFontOfSize:19]; | |
| 158 | + } | |
| 159 | + return _cycleViewTitle; | |
| 160 | +} | |
| 161 | + | |
| 162 | +- (void)removeFromSuperview { | |
| 163 | + [super removeFromSuperview]; | |
| 164 | + | |
| 165 | + [_timer invalidate]; | |
| 166 | + _timer = nil; | |
| 167 | +} | |
| 168 | + | |
| 169 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBSearchView.h
0 → 100644
| 1 | +// | |
| 2 | +// JBSearchView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/22. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface JBSearchView : UIView | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) NSArray *sortArray; | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/JBSearchView.m
0 → 100644
| 1 | +// | |
| 2 | +// JBSearchView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/22. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "JBSearchView.h" | |
| 10 | + | |
| 11 | +@interface JBSearchView() | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) UIButton *searchBtn; | |
| 14 | +@property (nonatomic, strong) UIView *searchLine; | |
| 15 | +@property (nonatomic, strong) UIView *sortBtnBackground; | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +@implementation JBSearchView | |
| 20 | + | |
| 21 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 22 | +{ | |
| 23 | + self = [super initWithFrame:frame]; | |
| 24 | + if (self) { | |
| 25 | + [self addSubview:self.searchBtn]; | |
| 26 | + } | |
| 27 | + return self; | |
| 28 | +} | |
| 29 | + | |
| 30 | +- (void)setSortArray:(NSArray *)sortArray { | |
| 31 | + | |
| 32 | + if (_sortArray != sortArray) { | |
| 33 | + _sortArray = sortArray; | |
| 34 | + | |
| 35 | + if ([Tools isArray:sortArray]) { | |
| 36 | + | |
| 37 | + [self addSubview:self.sortBtnBackground]; | |
| 38 | + CGFloat width = 13; | |
| 39 | + for (int i = 0; i < sortArray.count; i++) { | |
| 40 | + NSDictionary *dic = [sortArray safetyObjectAtIndex:i]; | |
| 41 | + NSString *name = dic[@"name"]; | |
| 42 | + CGRect rect = [name boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15]} context:nil]; | |
| 43 | + UIButton *sortBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 44 | + sortBtn.tag = 100+i; | |
| 45 | + sortBtn.frame = CGRectMake(width, 0, rect.size.width, 33); | |
| 46 | + sortBtn.titleLabel.font = [UIFont systemFontOfSize:14]; | |
| 47 | + [sortBtn setTitle:name forState:UIControlStateNormal]; | |
| 48 | + [sortBtn setTitleColor:[UIColor grayColorCNLive] forState:UIControlStateNormal]; | |
| 49 | + [sortBtn addTarget:self action:@selector(sortBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 50 | + [self.sortBtnBackground addSubview:sortBtn]; | |
| 51 | + width += rect.size.width + 13; | |
| 52 | + } | |
| 53 | + self.sortBtnBackground.width = width; | |
| 54 | + self.sortBtnBackground.x = KScreenWidth-self.sortBtnBackground.width-10; | |
| 55 | + self.searchBtn.width = KScreenWidth-20-7-self.sortBtnBackground.width; | |
| 56 | + [self addSubview:self.sortBtnBackground]; | |
| 57 | + | |
| 58 | + } else { | |
| 59 | + | |
| 60 | + self.searchBtn.width = KScreenWidth-20; | |
| 61 | + [self.sortBtnBackground removeFromSuperview]; | |
| 62 | + } | |
| 63 | + } | |
| 64 | +} | |
| 65 | + | |
| 66 | +#pragma mark - ACtion !!!!!!!!!!!!!!!!!!!!!!! | |
| 67 | +- (void)searchBtnAction { | |
| 68 | + | |
| 69 | + NSLog(@"搜索!!!!!!"); | |
| 70 | +} | |
| 71 | + | |
| 72 | +- (void)sortBtnAction:(UIButton *)button | |
| 73 | +{ | |
| 74 | + NSLog(@"分类按钮!!!!!"); | |
| 75 | + | |
| 76 | + NSDictionary *dic = [_sortArray safetyObjectAtIndex:button.tag-100]; | |
| 77 | +// SortViewController *sort=[[SortViewController alloc] init]; | |
| 78 | +// sort.searchBtn = YES; | |
| 79 | +// sort.title = _model.title; | |
| 80 | +// sort.cid = self.model.cid; | |
| 81 | +// if ([Tools isDictionary:dic]) { | |
| 82 | +// sort.sortId = dic[@"id"]; | |
| 83 | +// sort.sortType = dic[@"type"]; | |
| 84 | +// } | |
| 85 | +// [self.viewController.navigationController pushViewController:sort animated:YES]; | |
| 86 | +} | |
| 87 | + | |
| 88 | +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 89 | +- (UIButton *)searchBtn { | |
| 90 | + if (!_searchBtn) { | |
| 91 | + _searchBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 92 | + _searchBtn.frame = CGRectMake(10, 6, KScreenWidth-20, 33); | |
| 93 | + [_searchBtn setImage:[UIImage imageNamed:@"search"] forState:UIControlStateNormal]; | |
| 94 | + [_searchBtn setTitle:@"搜索" forState:UIControlStateNormal]; | |
| 95 | + [_searchBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; | |
| 96 | + [_searchBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -5, 0, 0)]; | |
| 97 | + _searchBtn.titleLabel.font = [UIFont systemFontOfSize:14]; | |
| 98 | + _searchBtn.backgroundColor = [UIColor whiteColor]; | |
| 99 | + _searchBtn.layer.cornerRadius = 16; | |
| 100 | + _searchBtn.layer.masksToBounds = YES; | |
| 101 | + [_searchBtn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 102 | + } | |
| 103 | + return _searchBtn; | |
| 104 | +} | |
| 105 | + | |
| 106 | +- (UIView *)sortBtnBackground | |
| 107 | +{ | |
| 108 | + if (!_sortBtnBackground) { | |
| 109 | + _sortBtnBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 6, 0, 33)]; | |
| 110 | + _sortBtnBackground.backgroundColor = [UIColor whiteColor]; | |
| 111 | + _sortBtnBackground.layer.cornerRadius = 16; | |
| 112 | + _sortBtnBackground.layer.masksToBounds = YES; | |
| 113 | + } | |
| 114 | + return _sortBtnBackground; | |
| 115 | +} | |
| 116 | + | |
| 117 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCChannelPagingView.m
| ... | ... | @@ -7,6 +7,13 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "LVCChannelPagingView.h" |
| 10 | +#import "LVCMainHeaderCollectionReusableView.h" | |
| 11 | +#import "LVCSectionHeaderCollectionReusableView.h" | |
| 12 | +#import "LVCMainHorizontalCollectionViewCell.h" | |
| 13 | + | |
| 14 | +static NSString *mainHeaderId = @"mainHeader"; | |
| 15 | +static NSString *SectionHeaderId = @"SectionHeader"; | |
| 16 | +static NSString *MainHorizontalCellId = @"MainHorizontalCell"; | |
| 10 | 17 | |
| 11 | 18 | @interface LVCChannelPagingView() <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout> { |
| 12 | 19 | |
| ... | ... | @@ -150,38 +157,61 @@ |
| 150 | 157 | #pragma mark - UICollectionViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!! |
| 151 | 158 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { |
| 152 | 159 | |
| 153 | - return 0; | |
| 160 | + return 4; | |
| 154 | 161 | } |
| 155 | 162 | |
| 156 | 163 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { |
| 157 | 164 | |
| 158 | - return 0; | |
| 165 | + return 6; | |
| 159 | 166 | } |
| 160 | 167 | |
| 161 | 168 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { |
| 162 | 169 | |
| 163 | - return nil; | |
| 170 | + LVCMainHorizontalCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:MainHorizontalCellId forIndexPath:indexPath]; | |
| 171 | + cell.backgroundColor = [UIColor blueColor]; | |
| 172 | + return cell; | |
| 164 | 173 | } |
| 165 | 174 | |
| 166 | 175 | - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { |
| 167 | 176 | |
| 177 | + if (indexPath.section == 0) { | |
| 178 | + LVCMainHeaderCollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:mainHeaderId forIndexPath:indexPath]; | |
| 179 | + view.backgroundColor = [UIColor redColor]; | |
| 180 | + return view; | |
| 181 | + } else { | |
| 182 | + LVCSectionHeaderCollectionReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:SectionHeaderId forIndexPath:indexPath]; | |
| 183 | + view.backgroundColor = [UIColor yellowColor]; | |
| 184 | + | |
| 185 | + LVCChannelDetailModel *model = [[LVCChannelDetailModel alloc] init]; | |
| 186 | + model.title = [NSString stringWithFormat:@"这是第%ld组",(long)indexPath.section]; | |
| 187 | + view.model = model; | |
| 188 | + | |
| 189 | + return view; | |
| 190 | + } | |
| 168 | 191 | return nil; |
| 169 | 192 | } |
| 170 | 193 | |
| 171 | 194 | #pragma mark - UICollectionViewDelegateFlowLayout !!!!!!!!!!!!!!!!!!!!!!!!! |
| 172 | 195 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { |
| 173 | 196 | |
| 174 | - return CGSizeZero; | |
| 197 | + return CGSizeMake(KScreenWidth*0.4, 80); | |
| 175 | 198 | } |
| 176 | 199 | |
| 177 | 200 | - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { |
| 178 | 201 | |
| 179 | - return UIEdgeInsetsZero; | |
| 202 | + if (section == 0) { | |
| 203 | + return UIEdgeInsetsMake(0, 0, 0, 0); | |
| 204 | + } | |
| 205 | + return UIEdgeInsetsMake(5, 10, 5, 4); | |
| 180 | 206 | } |
| 181 | 207 | |
| 182 | 208 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { |
| 183 | 209 | |
| 184 | - return CGSizeZero; | |
| 210 | + if (section == 0) { | |
| 211 | + return CGSizeMake(KScreenWidth, 300); | |
| 212 | + } else { | |
| 213 | + return CGSizeMake(KScreenWidth, 47); | |
| 214 | + } | |
| 185 | 215 | } |
| 186 | 216 | |
| 187 | 217 | #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| ... | ... | @@ -190,13 +220,18 @@ |
| 190 | 220 | if (!_collectionView) { |
| 191 | 221 | |
| 192 | 222 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; |
| 193 | - layout.minimumLineSpacing = 0; | |
| 223 | + layout.minimumLineSpacing = 10; | |
| 194 | 224 | layout.minimumInteritemSpacing = 0; |
| 195 | 225 | |
| 196 | - _collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:layout]; | |
| 226 | + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - 64 - 49) collectionViewLayout:layout]; | |
| 197 | 227 | _collectionView.delegate = self; |
| 198 | 228 | _collectionView.dataSource = self; |
| 199 | 229 | _collectionView.backgroundColor = [UIColor whiteColor]; |
| 230 | + [_collectionView registerClass:[LVCMainHeaderCollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:mainHeaderId]; | |
| 231 | + | |
| 232 | + [_collectionView registerClass:[LVCSectionHeaderCollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:SectionHeaderId]; | |
| 233 | + | |
| 234 | + [_collectionView registerClass:[LVCMainHorizontalCollectionViewCell class] forCellWithReuseIdentifier:MainHorizontalCellId]; | |
| 200 | 235 | } |
| 201 | 236 | return _collectionView; |
| 202 | 237 | } | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCMainHeaderCollectionReusableView.m
| ... | ... | @@ -7,13 +7,76 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "LVCMainHeaderCollectionReusableView.h" |
| 10 | +#import "JBSearchView.h" | |
| 11 | +#import "JBBannerView.h" | |
| 12 | +#import "JBAutoRollTableView.h" | |
| 10 | 13 | |
| 11 | 14 | @interface LVCMainHeaderCollectionReusableView() |
| 12 | 15 | |
| 16 | +@property (nonatomic, strong) JBBannerView *bannerView; | |
| 17 | +@property (nonatomic, strong) JBAutoRollTableView *rollTableView; | |
| 18 | +@property (nonatomic, strong) JBSearchView *searchView; | |
| 19 | + | |
| 13 | 20 | @end |
| 14 | 21 | |
| 15 | 22 | @implementation LVCMainHeaderCollectionReusableView |
| 16 | 23 | |
| 24 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 25 | +{ | |
| 26 | + self = [super initWithFrame:frame]; | |
| 27 | + if (self) { | |
| 28 | + [self addSubview:self.searchView]; | |
| 29 | + [self addSubview:self.bannerView]; | |
| 30 | + [self addSubview:self.rollTableView]; | |
| 31 | + } | |
| 32 | + return self; | |
| 33 | +} | |
| 34 | + | |
| 35 | +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 36 | +- (JBSearchView *)searchView { | |
| 37 | + | |
| 38 | + if (!_searchView) { | |
| 39 | + _searchView = [[JBSearchView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 45)]; | |
| 40 | + _searchView.backgroundColor = [UIColor backgroundColor]; | |
| 41 | + | |
| 42 | + NSMutableArray *arrayM = [[NSMutableArray alloc] init]; | |
| 43 | + NSDictionary *dict1 = @{@"name":@"liveShow"}; | |
| 44 | + [arrayM addObject:dict1]; | |
| 45 | + NSDictionary *dict2 = @{@"name":@"全部"}; | |
| 46 | + [arrayM addObject:dict2]; | |
| 47 | + _searchView.sortArray = arrayM; | |
| 48 | + | |
| 49 | + } | |
| 50 | + return _searchView; | |
| 51 | +} | |
| 52 | + | |
| 53 | +- (JBBannerView *)bannerView { | |
| 54 | + | |
| 55 | + if (!_bannerView) { | |
| 56 | + _bannerView = [[JBBannerView alloc] initWithFrame:CGRectMake(0, 70, self.bounds.size.width, self.bounds.size.width / 2 + 10)]; | |
| 57 | + _bannerView.backgroundColor = [UIColor purpleColor]; | |
| 58 | + } | |
| 59 | + return _bannerView; | |
| 60 | +} | |
| 17 | 61 | |
| 62 | +- (JBAutoRollTableView *)rollTableView { | |
| 63 | + | |
| 64 | + if (!_rollTableView) { | |
| 65 | + _rollTableView = [[JBAutoRollTableView alloc] initWithFrame:CGRectMake(39, 250, KScreenWidth-40-25+6, 36) style:UITableViewStylePlain]; | |
| 66 | + | |
| 67 | + NSMutableArray *arrayM = [[NSMutableArray alloc] init]; | |
| 68 | + ProgramModel *model1 = [[ProgramModel alloc] init]; | |
| 69 | + model1.title = @"嘉华大厦十大富豪榜"; | |
| 70 | + [arrayM addObject:model1]; | |
| 71 | + ProgramModel *model2 = [[ProgramModel alloc] init]; | |
| 72 | + model2.title = @"思考很久案发的感受"; | |
| 73 | + [arrayM addObject:model2]; | |
| 74 | + ProgramModel *model3 = [[ProgramModel alloc] init]; | |
| 75 | + model3.title = @"模拟电路罚款金额虽"; | |
| 76 | + [arrayM addObject:model3]; | |
| 77 | + _rollTableView.news = arrayM; | |
| 78 | + } | |
| 79 | + return _rollTableView; | |
| 80 | +} | |
| 18 | 81 | |
| 19 | 82 | @end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCMainHorizontalCollectionViewCell.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCMainHorizontalCollectionViewCell.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface LVCMainHorizontalCollectionViewCell : UICollectionViewCell | |
| 12 | + | |
| 13 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCMainHorizontalCollectionViewCell.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCMainHorizontalCollectionViewCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCMainHorizontalCollectionViewCell.h" | |
| 10 | + | |
| 11 | +@implementation LVCMainHorizontalCollectionViewCell | |
| 12 | + | |
| 13 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCSectionHeaderCollectionReusableView.h
0 → 100644
| 1 | +// | |
| 2 | +// LVCSectionHeaderCollectionReusableView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface LVCSectionHeaderCollectionReusableView : UICollectionReusableView | |
| 12 | + | |
| 13 | +@property (nonatomic, strong)LVCChannelDetailModel *model; | |
| 14 | +@property (nonatomic, assign)BOOL sort; | |
| 15 | +@property (nonatomic, assign)BOOL live; | |
| 16 | +@property (nonatomic, strong)NSString *channelId; | |
| 17 | +@property (nonatomic, strong)NSString *channelName; | |
| 18 | + | |
| 19 | +@end | ... | ... |
LiveVideoCloud/Classes/Sections/HomePageSections/LVCSectionHeaderCollectionReusableView.m
0 → 100644
| 1 | +// | |
| 2 | +// LVCSectionHeaderCollectionReusableView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by cnliveJunBo on 17/6/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "LVCSectionHeaderCollectionReusableView.h" | |
| 10 | + | |
| 11 | +@interface LVCSectionHeaderCollectionReusableView() | |
| 12 | + | |
| 13 | +@property (nonatomic, strong)UIButton *button; | |
| 14 | +@property (nonatomic, strong)UIImageView *arrow; | |
| 15 | + | |
| 16 | +@end | |
| 17 | + | |
| 18 | +@implementation LVCSectionHeaderCollectionReusableView | |
| 19 | + | |
| 20 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 21 | +{ | |
| 22 | + self = [super initWithFrame:frame]; | |
| 23 | + if (self) { | |
| 24 | + UIView *intervalView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 6)]; | |
| 25 | + intervalView.backgroundColor = [UIColor backgroundColor]; | |
| 26 | + [self addSubview:intervalView]; | |
| 27 | + [self addSubview:self.button]; | |
| 28 | + [self addSubview:self.arrow]; | |
| 29 | + } | |
| 30 | + return self; | |
| 31 | +} | |
| 32 | + | |
| 33 | +- (void)setModel:(LVCChannelDetailModel *)model { | |
| 34 | + if (_model != model) { | |
| 35 | + _model = model; | |
| 36 | + | |
| 37 | + [self.button setTitle:[NSString stringWithFormat:@" %@", model.title] forState:UIControlStateNormal]; | |
| 38 | + } | |
| 39 | +} | |
| 40 | + | |
| 41 | +#pragma mark - ACtion !!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 42 | +- (void)buttonAction { | |
| 43 | + | |
| 44 | + NSLog(@"跳转更多!!!!!!!!!!!!!!"); | |
| 45 | +} | |
| 46 | + | |
| 47 | +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!! | |
| 48 | +- (UIButton *)button { | |
| 49 | + | |
| 50 | + if (!_button) { | |
| 51 | + _button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 52 | + _button.frame = CGRectMake(0, 6, self.frame.size.width, 47); | |
| 53 | + [_button setTitleColor:[UIColor blackColorCNLive] forState:UIControlStateNormal]; | |
| 54 | + _button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | |
| 55 | + [_button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 56 | + _button.titleLabel.font = [UIFont boldSystemFontOfSize:18]; | |
| 57 | + } | |
| 58 | + return _button; | |
| 59 | +} | |
| 60 | + | |
| 61 | +- (UIImageView *)arrow { | |
| 62 | + | |
| 63 | + if (!_arrow) { | |
| 64 | + _arrow = [[UIImageView alloc] initWithFrame:CGRectMake(KScreenWidth-5-15, 19, 15, 21)]; | |
| 65 | + _arrow.image = [UIImage imageNamed:@"gengduo"]; | |
| 66 | + } | |
| 67 | + return _arrow; | |
| 68 | +} | |
| 69 | + | |
| 70 | +@end | ... | ... |
LiveVideoCloud/animation.xcassets/search.imageset/Contents.json