Commit 4bd6e7add4b57db45cb674241fba09b7756e83ec
1 parent
d27c7903
no message
Showing
2 changed files
with
0 additions
and
137 deletions
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNavigationBar.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveUserInfoNavigationBar.m | ||
| 3 | -// CNLiveMineModule | ||
| 4 | -// | ||
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | -// Copyright (c) 2019 153993236@qq.com. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <UIKit/UIKit.h> | ||
| 10 | - | ||
| 11 | -NS_ASSUME_NONNULL_BEGIN | ||
| 12 | -@class CNLiveUserInfoNavigationBar; | ||
| 13 | - | ||
| 14 | -@protocol CNLiveUserInfoNavigationBarDelegate <NSObject> | ||
| 15 | -- (void)navigationBar:(CNLiveUserInfoNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents; | ||
| 16 | - | ||
| 17 | -@end | ||
| 18 | - | ||
| 19 | -@interface CNLiveUserInfoNavigationBar : UIView | ||
| 20 | -@property (nonatomic, weak) id<CNLiveUserInfoNavigationBarDelegate> delegate; | ||
| 21 | -@property (nonatomic, strong) UIView *navView; | ||
| 22 | -@property (nonatomic, strong) UIButton *left; | ||
| 23 | -@property (nonatomic, strong) UILabel *title; | ||
| 24 | -@property (nonatomic, strong, nullable) UIButton *right; | ||
| 25 | - | ||
| 26 | - | ||
| 27 | -@end | ||
| 28 | - | ||
| 29 | -NS_ASSUME_NONNULL_END |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNavigationBar.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveUserInfoNavigationBar.m | ||
| 3 | -// CNLiveQrCodeModule | ||
| 4 | -// | ||
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | ||
| 6 | -// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "CNLiveUserInfoNavigationBar.h" | ||
| 10 | -#import "QMUIKit.h" | ||
| 11 | -#import "CNLiveCategory.h" | ||
| 12 | - | ||
| 13 | -@interface CNLiveUserInfoNavigationBar () | ||
| 14 | - | ||
| 15 | -@end | ||
| 16 | - | ||
| 17 | -@implementation CNLiveUserInfoNavigationBar | ||
| 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(@"CNLiveUserInfoNavigationBar -- 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, [UIScreen mainScreen].bounds.size.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.titleLabel.font = [UIFont systemFontOfSize:15]; | ||
| 63 | - _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); | ||
| 64 | - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoNavigationBar class]]; | ||
| 65 | - [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | ||
| 66 | - [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | ||
| 67 | - [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | ||
| 68 | - } | ||
| 69 | - return _left; | ||
| 70 | -} | ||
| 71 | - | ||
| 72 | -- (UILabel *)title { | ||
| 73 | - if (!_title) { | ||
| 74 | - _title = [[UILabel alloc] initWithFrame:CGRectMake(margin+NavigationBarHeight, StatusBarHeight, SCREEN_WIDTH-2*(margin+NavigationBarHeight), NavigationBarHeight)]; | ||
| 75 | - [_title setFont:[UIFont systemFontOfSize:18]]; | ||
| 76 | - _title.textColor = [UIColor blackColor]; | ||
| 77 | - _title.textAlignment = NSTextAlignmentCenter; | ||
| 78 | - } | ||
| 79 | - return _title; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -- (UIButton *)right { | ||
| 83 | - if (!_right) { | ||
| 84 | - _right = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 85 | - _right.frame = CGRectMake(SCREEN_WIDTH-50-margin, StatusBarHeight, 50, NavigationBarHeight); | ||
| 86 | - [_right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight]; | ||
| 87 | - _right.adjustsImageWhenHighlighted = NO; | ||
| 88 | - _right.titleLabel.font = [UIFont systemFontOfSize:15]; | ||
| 89 | - [_right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | ||
| 90 | - [_right addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 91 | - } | ||
| 92 | - return _right; | ||
| 93 | -} | ||
| 94 | - | ||
| 95 | -#pragma mark - 响应方法 | ||
| 96 | -- (void)goBack{ | ||
| 97 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | ||
| 98 | - [self.delegate navigationBar:self actionEvents:@"1"]; | ||
| 99 | - } | ||
| 100 | -} | ||
| 101 | -- (void)rightDidClicked:(UIButton *)btn{ | ||
| 102 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | ||
| 103 | - self.right.userInteractionEnabled = NO; | ||
| 104 | - [self.delegate navigationBar:self actionEvents:@"2"]; | ||
| 105 | - } | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -@end |