萤石云 iOSSDK,移植跨平台相关工程
Davin
2024-12-18 b4e1288a9b63eb820e9c9489c56aac4bf6b31067
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
//  HDLFVBaseViewController.m
//  Ezviz
//
//  Created by 陈启扬 on 2022/2/21.
//  Copyright © 2022 hdl. All rights reserved.
//
 
#import "HDLEZBaseViewController.h"
#import "HDLEZNoDataView.h"
@interface HDLEZBaseViewController ()
@property (nonatomic, strong)  HDLEZNoDataView *noDataV;
 
@end
 
@implementation HDLEZBaseViewController
 
- (void)viewDidLoad {
    [super viewDidLoad];
    //添加点击屏幕手势
    UITapGestureRecognizer *tapGr = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector (viewTapped)];
    tapGr.cancelsTouchesInView = NO ;
    [ self.view addGestureRecognizer:tapGr];
    
    self.view.backgroundColor=HDLEZ_COLOR_VIEW_BACKGROUND;
    
    [self addSubViews];
    // Do any additional setup after loading the view.
}
 
//设置标题和返回按钮
- (void)setTopBarViewWithTitle:(NSString *)title{
    [self.view addSubview:self.topBarView];
    self.topBarView.titleLabel.text = title;
}
 
-(void)addSubViews{
    //无数据View
    _noDataV=[[HDLEZNoDataView alloc] init];
    [self.view addSubview:_noDataV];
    [_noDataV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.view.mas_centerY);
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.height.mas_equalTo(60);
    }];
//    [_noDataV setHidden:YES];
 
}
 
 
/*展示无数据提示View
 */
-(void)showNoDataViewWithMessage:(NSString *)message {
    [_noDataV setHidden:NO];
    _noDataV.tipMsg=message;
    
    [self.view bringSubviewToFront:_noDataV];
}
 
 
/*隐藏无数据提示View
 */
-(void)hideNoDataView{
    [_noDataV setHidden:YES];
}
 
//退出编辑
-(void)viewTapped{
    //键盘退出
    [self.view endEditing:YES];
}
 
 
- (HDLEZTopBarView *)topBarView{
    if (!_topBarView) {
        _topBarView = [[HDLEZTopBarView alloc] initWithFrame: CGRectMake(0, 0, HDLEZ_APP_SCREEN_WIDTH, 40)];
        [_topBarView.leftButton addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
        [_topBarView.backButton addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    }
    return _topBarView;
}
 
 
/*返回
 */
- (void)goBack{
//    [self.navigationController popViewControllerAnimated:YES];
    if ([self.navigationController.viewControllers indexOfObject:self] == 0) {
        HDLEZLog(@"返回");
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    else {
        [self.navigationController popViewControllerAnimated:YES];
//        [self.navigationController popToRootViewControllerAnimated:YES];
    }
}
 
//设置右边按钮标题
-(void)setRightBtnTitle:(NSString *)rightBtnTitle{
    _rightBtnTitle=rightBtnTitle;
    _topBarView.rightBtnTitle=rightBtnTitle;
    [_topBarView.rightButton addTarget:self action:@selector(clickRightBtn) forControlEvents:UIControlEventTouchDown];
}
 
//点击右边按钮
-(void)clickRightBtn{
    
}
 
@end