Commit 7320753a89d8130ae98a5b395a6ce293150379f5
1 parent
50cab8fa
no message
Showing
6 changed files
with
46 additions
and
191 deletions
CNLiveIntegralModule.podspec
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.m
| ... | ... | @@ -22,14 +22,14 @@ |
| 22 | 22 | #import "CNLiveRefreshFooter.h" |
| 23 | 23 | #import "CNLiveCategory.h" |
| 24 | 24 | #import "CNLiveBaseKit.h" |
| 25 | +#import "CNLiveNavigationBar.h" | |
| 25 | 26 | |
| 26 | 27 | #import "CNLiveIntegralDetailsTableViewCell.h" |
| 27 | 28 | #import "CNLiveScoreModel.h" |
| 28 | -#import "CNLiveIntegralNavigationBar.h" | |
| 29 | 29 | |
| 30 | -@interface CNLiveIntegralDetailsController ()<UITableViewDelegate,UITableViewDataSource,CNLiveIntegralNavigationBarDelegate> | |
| 30 | +@interface CNLiveIntegralDetailsController ()<UITableViewDelegate,UITableViewDataSource> | |
| 31 | 31 | |
| 32 | -@property (nonatomic, strong) CNLiveIntegralNavigationBar *navigationBar; | |
| 32 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 33 | 33 | |
| 34 | 34 | @property (nonatomic, strong) UITableView *tableView; |
| 35 | 35 | @property (nonatomic, strong) NSMutableArray *data; |
| ... | ... | @@ -128,7 +128,6 @@ |
| 128 | 128 | - (void)createUI { |
| 129 | 129 | [self.view addSubview:self.navigationBar]; |
| 130 | 130 | [self.view addSubview:self.tableView]; |
| 131 | - | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | /* |
| ... | ... | @@ -171,26 +170,24 @@ |
| 171 | 170 | } |
| 172 | 171 | */ |
| 173 | 172 | |
| 174 | -#pragma mark - CNLiveIntegralNavigationBarDelegate | |
| 175 | -- (void)navigationBar:(CNLiveIntegralNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 176 | - if([actionEvents isEqualToString:@"1"]){ | |
| 177 | - [self.navigationController popViewControllerAnimated:YES]; | |
| 178 | - }else if([actionEvents isEqualToString:@"2"]){ | |
| 179 | - [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementIntegralRules]; | |
| 180 | - } | |
| 181 | -} | |
| 182 | - | |
| 183 | 173 | #pragma mark - Lazy loading |
| 184 | -- (CNLiveIntegralNavigationBar *)navigationBar { | |
| 174 | +- (CNLiveNavigationBar *)navigationBar { | |
| 185 | 175 | if (!_navigationBar) { |
| 186 | - _navigationBar = [[CNLiveIntegralNavigationBar alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 187 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 188 | - _navigationBar.delegate = self; | |
| 176 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 189 | 177 | _navigationBar.title.text = @"积分明细"; |
| 190 | - [_navigationBar.right setTitle:@"积分规则" forState:UIControlStateNormal]; | |
| 178 | + _navigationBar.rightTitle = @"积分规则"; | |
| 191 | 179 | [_navigationBar.right setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0] forState:UIControlStateNormal]; |
| 192 | 180 | _navigationBar.right.titleLabel.font = [UIFont systemFontOfSize:16.0]; |
| 193 | 181 | _navigationBar.right.frame = CGRectMake(SCREEN_WIDTH-80-15, StatusBarHeight, 80, NavigationBarHeight); |
| 182 | + __weak typeof(self) weakSelf = self; | |
| 183 | + _navigationBar.onClickLeftButton = ^{ | |
| 184 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 185 | + if(!strongSelf) return ; | |
| 186 | + [strongSelf.navigationController popViewControllerAnimated:YES]; | |
| 187 | + }; | |
| 188 | + _navigationBar.onClickRightButton = ^{ | |
| 189 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementIntegralRules]; | |
| 190 | + }; | |
| 194 | 191 | } |
| 195 | 192 | return _navigationBar; |
| 196 | 193 | } | ... | ... |
CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.m
| ... | ... | @@ -35,18 +35,18 @@ |
| 35 | 35 | //#import "CNFirendNewListViewController.h"//生活圈 |
| 36 | 36 | //#import "CNReportAndComplaintWebController.h"//帮助与反馈 |
| 37 | 37 | //#import "CNGifFaceListHeaderView.h" |
| 38 | +#import "CNLiveNavigationBar.h" | |
| 39 | + | |
| 38 | 40 | #import "CNLiveTaskListHeaderView.h" |
| 39 | 41 | #import "CNLiveIntegralDetailsController.h"//积分明细 |
| 40 | 42 | #import "CNLiveAddScoreManager.h" |
| 41 | 43 | |
| 42 | 44 | @interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNLiveTaskListTableViewCellDelegate,CNLiveTaskListHeaderViewDelegate> |
| 45 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 43 | 46 | @property (nonatomic, strong) UITableView *tableView; |
| 44 | 47 | @property (nonatomic, strong) CNLiveTaskListHeaderView *headView; |
| 45 | 48 | @property (nonatomic, strong) NSMutableArray *data; |
| 46 | 49 | |
| 47 | -@property (nonatomic, strong) UIButton *backButton; | |
| 48 | -@property (nonatomic, strong) UILabel *titleLabel; | |
| 49 | - | |
| 50 | 50 | @end |
| 51 | 51 | |
| 52 | 52 | @implementation CNLiveTaskListController |
| ... | ... | @@ -217,9 +217,8 @@ |
| 217 | 217 | |
| 218 | 218 | #pragma mark - UI |
| 219 | 219 | - (void)createUI { |
| 220 | - [self.headView addSubview:self.backButton]; | |
| 221 | - [self.headView addSubview:self.titleLabel]; | |
| 222 | 220 | [self.view addSubview:self.headView]; |
| 221 | + [self.view addSubview:self.navigationBar]; | |
| 223 | 222 | [self.view addSubview:self.tableView]; |
| 224 | 223 | |
| 225 | 224 | } |
| ... | ... | @@ -321,37 +320,8 @@ |
| 321 | 320 | */ |
| 322 | 321 | |
| 323 | 322 | #pragma mark - Action |
| 324 | -- (void)backDidClicked:(UIButton *)btn{ | |
| 325 | - [self.navigationController popViewControllerAnimated:YES]; | |
| 326 | - | |
| 327 | -} | |
| 328 | 323 | |
| 329 | 324 | #pragma mark - Lazy loading |
| 330 | -- (UIButton *)backButton { | |
| 331 | - if (!_backButton) { | |
| 332 | - _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 333 | - _backButton.adjustsImageWhenHighlighted = NO; | |
| 334 | - _backButton.frame = CGRectMake(15, StatusBarHeight, 44, 44); | |
| 335 | - [_backButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | |
| 336 | - UIImage *image = [self getImageWithImageName:@"mine_back_white_b" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; | |
| 337 | - [_backButton setImage:image forState:UIControlStateNormal]; | |
| 338 | - [_backButton addTarget:self action:@selector(backDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | |
| 339 | - } | |
| 340 | - return _backButton; | |
| 341 | -} | |
| 342 | - | |
| 343 | -- (UILabel *)titleLabel{ | |
| 344 | - if (!_titleLabel) { | |
| 345 | - _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, StatusBarHeight, 120, 44)]; | |
| 346 | - _titleLabel.centerX = self.view.centerX; | |
| 347 | - _titleLabel.text = @"任务列表"; | |
| 348 | - _titleLabel.font = [UIFont systemFontOfSize:18.0]; | |
| 349 | - _titleLabel.textColor = [UIColor whiteColor]; | |
| 350 | - _titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 351 | - } | |
| 352 | - return _titleLabel; | |
| 353 | -} | |
| 354 | - | |
| 355 | 325 | - (UITableView *)tableView { |
| 356 | 326 | if (!_tableView) { |
| 357 | 327 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; |
| ... | ... | @@ -386,9 +356,30 @@ |
| 386 | 356 | return _headView; |
| 387 | 357 | } |
| 388 | 358 | |
| 359 | +- (CNLiveNavigationBar *)navigationBar { | |
| 360 | + if (!_navigationBar) { | |
| 361 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 362 | + _navigationBar.backgroundColor = [UIColor clearColor]; | |
| 363 | + UIImage *image = [self getImageWithImageName:@"cnlive_back_white_b" bundleName:@"CNLiveCustomControl" targetClass:[CNLiveNavigationBar class]]; | |
| 364 | + _navigationBar.leftImage = image; | |
| 365 | + | |
| 366 | + _navigationBar.title.text = @"任务列表"; | |
| 367 | + _navigationBar.title.textColor = [UIColor whiteColor]; | |
| 368 | + _navigationBar.lineHidden = YES; | |
| 369 | + | |
| 370 | + __weak typeof(self) weakSelf = self; | |
| 371 | + _navigationBar.onClickLeftButton = ^{ | |
| 372 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 373 | + if(!strongSelf) return ; | |
| 374 | + [strongSelf.navigationController popViewControllerAnimated:YES]; | |
| 375 | + }; | |
| 376 | + | |
| 377 | + } | |
| 378 | + return _navigationBar; | |
| 379 | +} | |
| 380 | + | |
| 389 | 381 | - (UIStatusBarStyle)preferredStatusBarStyle{ |
| 390 | 382 | return UIStatusBarStyleLightContent; |
| 391 | 383 | } |
| 392 | 384 | |
| 393 | - | |
| 394 | 385 | @end | ... | ... |
CNLiveIntegralModule/Classes/View/CNLiveIntegralNavigationBar.h deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveIntegralNavigationBar.h | |
| 3 | -// CNLiveIntegralModule | |
| 4 | -// | |
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | -// Copyright © 2019 153993236@qq.com. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import <UIKit/UIKit.h> | |
| 10 | - | |
| 11 | -NS_ASSUME_NONNULL_BEGIN | |
| 12 | - | |
| 13 | -@class CNLiveIntegralNavigationBar; | |
| 14 | - | |
| 15 | -@protocol CNLiveIntegralNavigationBarDelegate <NSObject> | |
| 16 | -- (void)navigationBar:(CNLiveIntegralNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents; | |
| 17 | - | |
| 18 | -@end | |
| 19 | - | |
| 20 | -@interface CNLiveIntegralNavigationBar : UIView | |
| 21 | -@property (nonatomic, weak) id<CNLiveIntegralNavigationBarDelegate> delegate; | |
| 22 | -@property (nonatomic, strong) UIView *navView; | |
| 23 | -@property (nonatomic, strong) UIButton *left; | |
| 24 | -@property (nonatomic, strong) UILabel *title; | |
| 25 | -@property (nonatomic, strong, nullable) UIButton *right; | |
| 26 | - | |
| 27 | - | |
| 28 | -@end | |
| 29 | - | |
| 30 | -NS_ASSUME_NONNULL_END |
CNLiveIntegralModule/Classes/View/CNLiveIntegralNavigationBar.m deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveIntegralNavigationBar.m | |
| 3 | -// CNLiveIntegralModule | |
| 4 | -// | |
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | -// Copyright © 2019 153993236@qq.com. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "CNLiveIntegralNavigationBar.h" | |
| 10 | -#import "QMUIKit.h" | |
| 11 | -#import "CNLiveCategory.h" | |
| 12 | - | |
| 13 | -@interface CNLiveIntegralNavigationBar () | |
| 14 | - | |
| 15 | -@end | |
| 16 | - | |
| 17 | -@implementation CNLiveIntegralNavigationBar | |
| 18 | -static const NSInteger margin = 15; | |
| 19 | - | |
| 20 | -- (instancetype)initWithFrame:(CGRect)frame{ | |
| 21 | - self = [super initWithFrame:frame]; | |
| 22 | - if(self){ | |
| 23 | - self.userInteractionEnabled = YES; | |
| 24 | - self.backgroundColor = [UIColor clearColor]; | |
| 25 | - [self createSubViews]; | |
| 26 | - } | |
| 27 | - return self; | |
| 28 | -} | |
| 29 | - | |
| 30 | -- (void)dealloc { | |
| 31 | - NSLog(@"CNLiveIntegralNavigationBar -- dealloc"); | |
| 32 | -} | |
| 33 | - | |
| 34 | -- (void)createSubViews { | |
| 35 | - [self addSubview:self.navView]; | |
| 36 | - [self addSubview:self.left]; | |
| 37 | - [self addSubview:self.title]; | |
| 38 | - [self addSubview:self.right]; | |
| 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 | -#pragma mark - 懒加载 | |
| 50 | -- (UIView *)navView { | |
| 51 | - if (!_navView) { | |
| 52 | - _navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 53 | - _navView.backgroundColor = [UIColor clearColor]; | |
| 54 | - } | |
| 55 | - return _navView; | |
| 56 | -} | |
| 57 | - | |
| 58 | -- (UIButton *)left { | |
| 59 | - if (!_left) { | |
| 60 | - _left= [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 61 | - _left.adjustsImageWhenHighlighted = NO; | |
| 62 | - _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); | |
| 63 | - UIImage *image = [self getImageWithImageName:@"code_back_black_b" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; | |
| 64 | - [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | |
| 65 | - [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | |
| 66 | - [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | |
| 67 | - } | |
| 68 | - return _left; | |
| 69 | -} | |
| 70 | - | |
| 71 | -- (UILabel *)title { | |
| 72 | - if (!_title) { | |
| 73 | - _title = [[UILabel alloc] initWithFrame:CGRectMake(margin+NavigationBarHeight, StatusBarHeight, SCREEN_WIDTH-2*(margin+NavigationBarHeight), NavigationBarHeight)]; | |
| 74 | - [_title setFont:[UIFont systemFontOfSize:18]]; | |
| 75 | - _title.textColor = [UIColor blackColor]; | |
| 76 | - _title.textAlignment = NSTextAlignmentCenter; | |
| 77 | - } | |
| 78 | - return _title; | |
| 79 | -} | |
| 80 | - | |
| 81 | -- (UIButton *)right { | |
| 82 | - if (!_right) { | |
| 83 | - _right = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 84 | - _right.frame = CGRectMake(SCREEN_WIDTH-50-margin, StatusBarHeight, 50, NavigationBarHeight); | |
| 85 | - [_right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight]; | |
| 86 | - _right.adjustsImageWhenHighlighted = NO; | |
| 87 | - _right.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 88 | - [_right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | |
| 89 | - [_right addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | |
| 90 | - } | |
| 91 | - return _right; | |
| 92 | -} | |
| 93 | - | |
| 94 | -#pragma mark - 响应方法 | |
| 95 | -- (void)goBack{ | |
| 96 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | |
| 97 | - [self.delegate navigationBar:self actionEvents:@"1"]; | |
| 98 | - } | |
| 99 | -} | |
| 100 | - | |
| 101 | -- (void)rightDidClicked:(UIButton *)btn{ | |
| 102 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | |
| 103 | - [self.delegate navigationBar:self actionEvents:@"2"]; | |
| 104 | - } | |
| 105 | -} | |
| 106 | - | |
| 107 | -@end | |
| 108 | - |
Example/CNLiveIntegralModule.xcodeproj/project.pbxproj
| ... | ... | @@ -332,6 +332,7 @@ |
| 332 | 332 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 333 | 333 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", |
| 334 | 334 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", |
| 335 | + "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework", | |
| 335 | 336 | "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework", |
| 336 | 337 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| 337 | 338 | "${BUILT_PRODUCTS_DIR}/CNLiveIntegralModule/CNLiveIntegralModule.framework", |
| ... | ... | @@ -354,6 +355,7 @@ |
| 354 | 355 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 355 | 356 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", |
| 356 | 357 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", |
| 358 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework", | |
| 357 | 359 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework", |
| 358 | 360 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
| 359 | 361 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveIntegralModule.framework", | ... | ... |