Commit bd1dd4c230f60f87cc03a1fd4976f98008559de1
1 parent
25066c26
no message
Showing
6 changed files
with
101 additions
and
60 deletions
CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.m
| ... | ... | @@ -15,8 +15,8 @@ |
| 15 | 15 | |
| 16 | 16 | #import "CNLiveServices.h" |
| 17 | 17 | |
| 18 | -//#import "CNLiveMineNavigationBar.h" | |
| 19 | 18 | #import "CNLiveTaskListTableViewCell.h" |
| 19 | +#import "CNLiveTaskListSectionHeaderView.h" | |
| 20 | 20 | #import "CNLiveTaskListModel.h" |
| 21 | 21 | #import "CNLiveGoldWhereaboutsView.h"//金币下落 |
| 22 | 22 | #import "CNLiveAddScoreView.h" |
| ... | ... | @@ -35,16 +35,16 @@ |
| 35 | 35 | //#import "CNFirendNewListViewController.h"//生活圈 |
| 36 | 36 | //#import "CNReportAndComplaintWebController.h"//帮助与反馈 |
| 37 | 37 | //#import "CNGifFaceListHeaderView.h" |
| 38 | -#import "CNLiveTaskListHeadView.h" | |
| 38 | +#import "CNLiveTaskListHeaderView.h" | |
| 39 | 39 | #import "CNLiveIntegralDetailsController.h"//积分明细 |
| 40 | 40 | #import "CNLiveAddScoreManager.h" |
| 41 | 41 | //#import "CNTouristsLoginTipsView.h" |
| 42 | 42 | //#import "CNWebRedirectHandle.h" |
| 43 | 43 | |
| 44 | 44 | //@interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNTaskListTableViewCellDelegate,CNLiveTaskListHeadViewDelegate,TouristsLoginTipsViewDelegate> |
| 45 | -@interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNLiveTaskListTableViewCellDelegate,CNLiveTaskListHeadViewDelegate> | |
| 45 | +@interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNLiveTaskListTableViewCellDelegate,CNLiveTaskListHeaderViewDelegate> | |
| 46 | 46 | @property (nonatomic, strong) UITableView *tableView; |
| 47 | -@property (nonatomic, strong) CNLiveTaskListHeadView *headView; | |
| 47 | +@property (nonatomic, strong) CNLiveTaskListHeaderView *headView; | |
| 48 | 48 | @property (nonatomic, strong) NSMutableArray *data; |
| 49 | 49 | |
| 50 | 50 | @property (nonatomic, strong) UIButton *backButton; |
| ... | ... | @@ -364,24 +364,23 @@ |
| 364 | 364 | } |
| 365 | 365 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ |
| 366 | 366 | NSArray *arr = @[@"每日任务",@"首次任务"]; |
| 367 | - UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 45)]; | |
| 368 | - view.backgroundColor = [UIColor whiteColor]; | |
| 369 | - UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 45)]; | |
| 370 | - title.text = arr[section]; | |
| 371 | - title.textColor = [UIColor blackColor]; | |
| 372 | - title.font = [UIFont systemFontOfSize:16.0]; | |
| 373 | - [view addSubview:title]; | |
| 374 | - return view; | |
| 367 | + CNLiveTaskListSectionHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNLiveTaskListSectionHeaderView]; | |
| 368 | + header.text = arr[section]; | |
| 369 | + return header; | |
| 375 | 370 | } |
| 371 | +- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ | |
| 372 | + return nil; | |
| 373 | +} | |
| 374 | + | |
| 376 | 375 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ |
| 377 | - return 0.000001; // 注意要设置为0.1,不能设置为0 | |
| 376 | + return 0.1; // 注意要设置为0.1,不能设置为0 | |
| 378 | 377 | } |
| 379 | 378 | |
| 380 | 379 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
| 381 | 380 | return 45.0; // 注意要设置为0.1,不能设置为0 |
| 382 | 381 | } |
| 383 | 382 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 384 | - return 40+30; | |
| 383 | + return 70; | |
| 385 | 384 | |
| 386 | 385 | } |
| 387 | 386 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ |
| ... | ... | @@ -390,33 +389,11 @@ |
| 390 | 389 | } |
| 391 | 390 | |
| 392 | 391 | #pragma mark - CNLiveTaskListHeadViewDelegate |
| 393 | -- (void)clickedDetailButton:(CNLiveTaskListHeadView *)view{ | |
| 392 | +- (void)clickedDetailButton:(CNLiveTaskListHeaderView *)view{ | |
| 394 | 393 | CNLiveIntegralDetailsController *vc = [[CNLiveIntegralDetailsController alloc] init]; |
| 395 | 394 | [self.navigationController pushViewController:vc animated:YES]; |
| 396 | 395 | } |
| 397 | -#pragma mark - TouristsLoginTipsViewDelegate | |
| 398 | -//- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify{ | |
| 399 | -// if([isClassify isEqualToString:@"close"]){ | |
| 400 | -// //隐藏TouristsLoginTipsView | |
| 401 | -// [self.fuzzyView removeFromSuperview]; | |
| 402 | -// | |
| 403 | -// }else if([isClassify isEqualToString:@"jump"]){ | |
| 404 | -// //进入频道管理页面 | |
| 405 | -// [self.fuzzyView removeFromSuperview]; | |
| 406 | -// CNTabBarViewController *tabbarController = (CNTabBarViewController *)[AppDelegate sharedAppDelegate].window.rootViewController; | |
| 407 | -// tabbarController.selectedIndex = 1; | |
| 408 | -// //分类 | |
| 409 | -// CNNavigationController *nav = tabbarController.childViewControllers[1]; | |
| 410 | -// CNClassifySegmentController *vc = nav.childViewControllers[0]; | |
| 411 | -// | |
| 412 | -// if([vc isKindOfClass:[CNClassifySegmentController class]]){ | |
| 413 | -// [vc customAction:nil]; | |
| 414 | -// | |
| 415 | -// } | |
| 416 | -// | |
| 417 | -// } | |
| 418 | -// | |
| 419 | -//} | |
| 396 | + | |
| 420 | 397 | /* |
| 421 | 398 | #pragma mark - Navigation |
| 422 | 399 | |
| ... | ... | @@ -470,6 +447,8 @@ |
| 470 | 447 | _tableView.showsHorizontalScrollIndicator = NO; |
| 471 | 448 | _tableView.bounces = NO; |
| 472 | 449 | [_tableView registerClass:[CNLiveTaskListTableViewCell class] forCellReuseIdentifier:kCNLiveTaskListTableViewCell]; |
| 450 | + [_tableView registerClass:[CNLiveTaskListSectionHeaderView class] forHeaderFooterViewReuseIdentifier:kCNLiveTaskListSectionHeaderView]; | |
| 451 | + | |
| 473 | 452 | } |
| 474 | 453 | return _tableView; |
| 475 | 454 | } |
| ... | ... | @@ -481,9 +460,9 @@ |
| 481 | 460 | return _data; |
| 482 | 461 | } |
| 483 | 462 | |
| 484 | -- (CNLiveTaskListHeadView *)headView{ | |
| 463 | +- (CNLiveTaskListHeaderView *)headView{ | |
| 485 | 464 | if (!_headView) { |
| 486 | - _headView = [[CNLiveTaskListHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop+SCREEN_WIDTH*100/375.0)]; | |
| 465 | + _headView = [[CNLiveTaskListHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop+SCREEN_WIDTH*100/375.0)]; | |
| 487 | 466 | UIImage *image = [self xw_getImageName:@"integrate_list_bg" bundleName:@"CNLiveIntegralModule" targetClass:[CNLiveTaskListController class]]; |
| 488 | 467 | _headView.image = image; |
| 489 | 468 | _headView.delegate = self; |
| ... | ... | @@ -491,16 +470,6 @@ |
| 491 | 470 | return _headView; |
| 492 | 471 | } |
| 493 | 472 | |
| 494 | -//- (CNTouristsLoginTipsView *)fuzzyView{ | |
| 495 | -// if (!_fuzzyView) { | |
| 496 | -// _fuzzyView = [[CNTouristsLoginTipsView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds]; | |
| 497 | -// _fuzzyView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6]; | |
| 498 | -// _fuzzyView.delegate = self; | |
| 499 | -// } | |
| 500 | -// return _fuzzyView; | |
| 501 | -// | |
| 502 | -//} | |
| 503 | - | |
| 504 | 473 | - (UIImage *)navigationBarBackgroundImage{ |
| 505 | 474 | return [UIImage imageWithColor:[UIColor clearColor]]; |
| 506 | 475 | } | ... | ... |
CNLiveIntegralModule/Classes/Module/CNLiveIntegralService.m
CNLiveIntegralModule/Classes/View/CNLiveTaskListHeadView.h renamed to CNLiveIntegralModule/Classes/View/CNLiveTaskListHeaderView.h
| 1 | 1 | // |
| 2 | -// CNLiveTaskListHeadView.h | |
| 2 | +// CNLiveTaskListHeaderView.h | |
| 3 | 3 | // CNLiveIntegralModule |
| 4 | 4 | // |
| 5 | 5 | // Created by CNLive-zxw on 2019/2/28. |
| ... | ... | @@ -9,13 +9,13 @@ |
| 9 | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | |
| 11 | 11 | NS_ASSUME_NONNULL_BEGIN |
| 12 | -@class CNLiveTaskListHeadView; | |
| 13 | -@protocol CNLiveTaskListHeadViewDelegate <NSObject> | |
| 14 | -- (void)clickedDetailButton:(CNLiveTaskListHeadView *)view; | |
| 12 | +@class CNLiveTaskListHeaderView; | |
| 13 | +@protocol CNLiveTaskListHeaderViewDelegate <NSObject> | |
| 14 | +- (void)clickedDetailButton:(CNLiveTaskListHeaderView *)view; | |
| 15 | 15 | |
| 16 | 16 | @end |
| 17 | -@interface CNLiveTaskListHeadView : UIImageView | |
| 18 | -@property (nonatomic, weak) id<CNLiveTaskListHeadViewDelegate> delegate; | |
| 17 | +@interface CNLiveTaskListHeaderView : UIImageView | |
| 18 | +@property (nonatomic, weak) id<CNLiveTaskListHeaderViewDelegate> delegate; | |
| 19 | 19 | @property (nonatomic, copy) NSString *score; |
| 20 | 20 | |
| 21 | 21 | @end | ... | ... |
CNLiveIntegralModule/Classes/View/CNLiveTaskListHeadView.m renamed to CNLiveIntegralModule/Classes/View/CNLiveTaskListHeaderView.m
| 1 | 1 | // |
| 2 | -// CNLiveTaskListHeadView.m | |
| 2 | +// CNLiveTaskListHeaderView.m | |
| 3 | 3 | // CNLiveIntegralModule |
| 4 | 4 | // |
| 5 | 5 | // Created by CNLive-zxw on 2019/2/28. |
| 6 | 6 | // Copyright © 2019年 cnlive. All rights reserved. |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | -#import "CNLiveTaskListHeadView.h" | |
| 9 | +#import "CNLiveTaskListHeaderView.h" | |
| 10 | 10 | #import "QMUIKit.h" |
| 11 | 11 | #import <Masonry/Masonry.h> |
| 12 | 12 | #import <SDWebImage/SDWebImage.h> |
| 13 | 13 | |
| 14 | 14 | #import "CNUserInfoManager.h" |
| 15 | 15 | |
| 16 | -@interface CNLiveTaskListHeadView() | |
| 16 | +@interface CNLiveTaskListHeaderView() | |
| 17 | 17 | @property (nonatomic, strong) UIImageView *headView; |
| 18 | 18 | @property (nonatomic, strong) UILabel *currentScore; |
| 19 | 19 | @property (nonatomic, strong) UILabel *getScore; |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | |
| 22 | 22 | @end |
| 23 | 23 | |
| 24 | -@implementation CNLiveTaskListHeadView | |
| 24 | +@implementation CNLiveTaskListHeaderView | |
| 25 | 25 | static const NSInteger margin = 15; |
| 26 | 26 | #pragma mark - Init |
| 27 | 27 | - (instancetype)initWithFrame:(CGRect)frame { | ... | ... |
CNLiveIntegralModule/Classes/View/CNLiveTaskListSectionHeaderView.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveTaskListSectionHeaderView.h | |
| 3 | +// CNLiveIntegralModule | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/11/19. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <UIKit/UIKit.h> | |
| 9 | + | |
| 10 | +#define kCNLiveTaskListSectionHeaderView @"CNLiveTaskListSectionHeaderView" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | + | |
| 14 | +@interface CNLiveTaskListSectionHeaderView : UITableViewHeaderFooterView | |
| 15 | +@property (nonatomic, copy) NSString *text; | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveIntegralModule/Classes/View/CNLiveTaskListSectionHeaderView.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveTaskListSectionHeaderView.m | |
| 3 | +// CNLiveIntegralModule | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/2/20. | |
| 6 | +// Copyright © 2019年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveTaskListSectionHeaderView.h" | |
| 10 | +#import "QMUIKit.h" | |
| 11 | + | |
| 12 | +@interface CNLiveTaskListSectionHeaderView() | |
| 13 | +/** 内部的label */ | |
| 14 | +@property (nonatomic, weak) UILabel *label; | |
| 15 | + | |
| 16 | +@end | |
| 17 | + | |
| 18 | +@implementation CNLiveTaskListSectionHeaderView | |
| 19 | +static const NSInteger margin = 15; | |
| 20 | + | |
| 21 | +- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{ | |
| 22 | + if (self = [super initWithReuseIdentifier:reuseIdentifier]) { | |
| 23 | + self.contentView.backgroundColor = [UIColor whiteColor]; | |
| 24 | + | |
| 25 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(margin, 0, 200, 45)]; | |
| 26 | + label.textColor = [UIColor blackColor]; | |
| 27 | + label.font = UIFontMake(16); | |
| 28 | + label.backgroundColor = [UIColor whiteColor]; | |
| 29 | + [self.contentView addSubview:label]; | |
| 30 | + self.label = label; | |
| 31 | + | |
| 32 | + } | |
| 33 | + return self; | |
| 34 | +} | |
| 35 | + | |
| 36 | + | |
| 37 | +- (void)setText:(NSString *)text{ | |
| 38 | + self.label.text = text; | |
| 39 | +} | |
| 40 | + | |
| 41 | +/* | |
| 42 | +// Only override drawRect: if you perform custom drawing. | |
| 43 | +// An empty implementation adversely affects performance during animation. | |
| 44 | +- (void)drawRect:(CGRect)rect { | |
| 45 | + // Drawing code | |
| 46 | +} | |
| 47 | +*/ | |
| 48 | + | |
| 49 | +@end | |
| 50 | + | ... | ... |