admin
2023-04-21 0b3a4aaf99ea251bc8e27b96115288f0988fcffe
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
//
//  NoNetworkView.m
//  BuWanVideo2.0
//
//  Created by 重庆迈尖科技有限公司 on 2018/8/28.
//  Copyright © 2018年 com.yeshi.buwansheque.ios. All rights reserved.
//
 
#import "NoNetworkView.h"
 
@implementation NoNetworkView
 
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = SJColor(254, 212 , 67,  1);
        [self addSubview:self.titleLabel];
        [self addSubview:self.jumpButton];
    }
    return self;
}
 
- (void)jumpSetting:(UIButton *)sender{
 
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
 
#pragma mark - getter
- (UILabel *)titleLabel{
    if (_titleLabel) {
        return _titleLabel;
    }
    _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(25, 0, self.frame.size.width, self.frame.size.height)];
    _titleLabel.textColor = SJColor(30, 144, 255, 1);
    _titleLabel.text = @"网络不可用,请检查网络";
    _titleLabel.font = [UIFont systemFontOfSize:15];
    
    return _titleLabel;
}
- (UIButton *)jumpButton{
    if (_jumpButton) {
        return _jumpButton;
    }
    _jumpButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _jumpButton.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    [_jumpButton addTarget:self action:@selector(jumpSetting:) forControlEvents:UIControlEventTouchUpInside];
    return _jumpButton;
}
@end