提交
This commit is contained in:
79
QXLive/Base/QXBaseViewController.m
Normal file
79
QXLive/Base/QXBaseViewController.m
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// QXBaseViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/4/24.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
@interface QXBaseViewController ()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)NSString *imageUrl;
|
||||
@end
|
||||
|
||||
@implementation QXBaseViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self.view insertSubview:self.bgImageView atIndex:0];
|
||||
[self updateBgImage:QXConfig.backgroundImage];
|
||||
[self initSubViews];
|
||||
[self setNavgationItems];
|
||||
[self getData];
|
||||
self.page = 1;
|
||||
}
|
||||
- (void)initSubViews{
|
||||
|
||||
}
|
||||
- (void)getData{
|
||||
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
||||
[backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
|
||||
backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
|
||||
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
|
||||
}
|
||||
-(void)backAction{
|
||||
if (self.navigationController.viewControllers.count > 1) {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
return;
|
||||
}else{
|
||||
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
-(void)setBgImageHidden:(BOOL)bgImageHidden{
|
||||
_bgImageHidden = bgImageHidden;
|
||||
self.bgImageView.hidden = bgImageHidden;
|
||||
}
|
||||
-(void)updateBgImage:(NSString *)imageUrl{
|
||||
_imageUrl = imageUrl;
|
||||
if (![imageUrl isExist]) {
|
||||
return;
|
||||
}
|
||||
if ([imageUrl hasPrefix:@"http"]) {
|
||||
[self.bgImageView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:nil];
|
||||
}else{
|
||||
self.bgImageView.image = [UIImage imageNamed:imageUrl];
|
||||
}
|
||||
}
|
||||
-(UIImageView *)bgImageView{
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
||||
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(void)dealloc{
|
||||
QXLOG(@"%@已销毁",NSStringFromClass([self class]));
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user