From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/screendisplay/Classes/检测/Controller/DetailDataViewController.m | 244 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 244 insertions(+), 0 deletions(-) diff --git "a/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m" "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m" new file mode 100644 index 0000000..9cbcd69 --- /dev/null +++ "b/screendisplay/screendisplay/Classes/\346\243\200\346\265\213/Controller/DetailDataViewController.m" @@ -0,0 +1,244 @@ +// +// DetailDataViewController.m +// screendisplay +// +// Created by ��������� on 2018/7/5. +// Copyright �� 2018��� ���������. All rights reserved. +// + +#import "DetailDataViewController.h" +#import "DetailService.h" +#import "CommonReqModel.h" +#import "DetailItemCell.h" +#import "DynamicViewController.h" + +@interface DetailDataViewController ()<UITableViewDelegate,UITableViewDataSource> +{ + +} + +@property(nonatomic,strong) UITableView * tableView; + +/** <#digest#> */ +@property (nonatomic, strong) DetailService *detailService; + +@end + +@implementation DetailDataViewController + +#pragma mark - getter + +- (DetailService *)detailService +{ + if(_detailService == nil) + { + _detailService = [[DetailService alloc] init]; + } + return _detailService; +} + +- (UITableView *)tableView +{ + if (!_tableView) + { + _tableView = [[UITableView alloc] init]; + + + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.frame = CGRectMake((SCREEN_WIDTH-AdaptedWidth(340))/2, NavBar_Height+AdaptedHeight(13), AdaptedWidth(350), AdaptedHeight(570)); + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = [UIColor clearColor]; + [self.view addSubview:_tableView]; + + UIImageView * viewBackground = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-AdaptedWidth(355))/2, NavBar_Height+AdaptedHeight(13), AdaptedWidth(355), AdaptedHeight(574))]; + viewBackground.image = [UIImage imageNamed:@"detail_back"]; + _tableView.backgroundView = viewBackground; + +// [_tableView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.edges.mas_equalTo(UIEdgeInsetsMake((SCREEN_WIDTH-AdaptedWidth(355))/2 , AdaptedHeight(13), AdaptedHeight(13),(SCREEN_WIDTH-AdaptedWidth(355))/2)); +// }]; + + _tableView.tableFooterView = [UIView new]; + } + return _tableView; +} + +#pragma mark - UITableViewDataSource UITableViewDelegate +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.detailService.detailViewModels.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return AdaptedHeight(42.0); +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + DetailItemCell *topicCell = [DetailItemCell topicCellWithTableView:tableView]; + topicCell.detailViewModel = self.detailService.detailViewModels[indexPath.row]; + return topicCell; +} + + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSInteger index = [indexPath row]; + + // 0 ������ 1 ������������ 2 ������������ 3 ������������ 4 ������ + if([self.deviceModel.state intValue] == 4) + { + [Global alertMessageEx:@"���������������������������������������������!" title:@"������������" okTtitle:nil cancelTitle:@"������" delegate:self]; + } + else + { + DynamicViewController * page = [[DynamicViewController alloc] init]; + page.detailModel = [self.detailService.detailViewModels objectAtIndex:index]; + [self.navigationController pushViewController:page animated:YES]; + } + + NSLog(@"click didSelectRowAtIndexPath"); +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + [self initView]; + + [self getDetailList]; +} + +-(void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:YES]; + + self.navigationController.navigationBarHidden = YES; +} + +-(void) initView +{ + // ������������������ + //self.fd_interactivePopDisabled = YES; + + self.view.backgroundColor = kUIColorFromRGB(0x0b2f76); + + +} + + + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + +#pragma mark custom function +-(void)getDetailList +{ + NSMutableDictionary *param = [[NSMutableDictionary alloc] init]; + [param setObject:self.deviceModel.deviceVersionId forKey:@"deviceVersionId"]; + [param setObject:self.deviceModel.mac forKey:@"mac"]; + [param setObject:self.deviceModel.id forKey:@"deviceId"]; + + TWWeak(self); + [self.detailService getDetailListWithParameters:param completion:^(NSString *desc, int code) { + if(code == 1) + { + weakself.tableView.hidden = NO; + [weakself.tableView reloadData]; + } + else + { + [Global alertMessageEx:desc title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self]; + } + }]; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +#pragma mark - LMJNavUIBaseViewControllerDataSource + +- (UIStatusBarStyle)navUIBaseViewControllerPreferStatusBarStyle:(LMJNavUIBaseViewController *)navUIBaseViewController +{ + return UIStatusBarStyleDefault; +} + +/**������������*/ +- (NSMutableAttributedString*)lmjNavigationBarTitle:(LMJNavigationBar *)navigationBar +{ + return [self changeTitle:@"������������" changeColor:[UIColor whiteColor]]; +} + +//������������ +//- (UIImage *)lmjNavigationBarBackgroundImage:(LMJNavigationBar *)navigationBar +//{ +// return [UIImage imageNamed:@"map_top_bar_bk"]; +//} + +/** ��������� */ +- (UIColor *)lmjNavigationBackgroundColor:(LMJNavigationBar *)navigationBar +{ + return kUIColorFromRGB(0x0b2f76); +} + +/** ������������������������ */ +- (BOOL)lmjNavigationIsHideBottomLine:(LMJNavigationBar *)navigationBar +{ + return YES; +} + +/** ������������������������ */ +- (UIImage *)lmjNavigationBarLeftButtonImage:(UIButton *)leftButton navigationBar:(LMJNavigationBar *)navigationBar +{ + return [UIImage imageNamed:@"map_back"]; +} +/** ������������������������ */ +- (UIImage *)lmjNavigationBarRightButtonImage:(UIButton *)rightButton navigationBar:(LMJNavigationBar *)navigationBar +{ + //return [UIImage imageNamed:@"map_back"]; + + // [rightButton setTitle:@"������������" forState: UIControlStateNormal]; + // [rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + // [rightButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted]; + // rightButton.titleLabel.font = [UIFont systemFontOfSize:15]; + // + // rightButton.lmj_width = 80; + + return nil; +} + +#pragma mark - LMJNavUIBaseViewControllerDelegate +/** ������������������������ */ +-(void)leftButtonEvent:(UIButton *)sender navigationBar:(LMJNavigationBar *)navigationBar +{ + [self.navigationController popViewControllerAnimated:YES]; + //[self dismissViewControllerAnimated:YES completion:nil]; +} + + +/** ������������������������ */ +-(void)rightButtonEvent:(UIButton *)sender navigationBar:(LMJNavigationBar *)navigationBar +{ + +} + + + +@end -- Gitblit v1.8.0