// // ElePictureVC.m // JSJPCoach // // Created by EchoShacolee on 2018/1/31. // Copyright © 2018年 Danson. All rights reserved. // #import "ElePictureVC.h" #import "ElePicView.h" #import "BigImgVC.h" @interface ElePictureVC () @end @implementation ElePictureVC - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = backGroundColor; UIScrollView *scrV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-40-kNavOffSet)]; CGFloat width = kSize.width/2-20; CGFloat height = width+50+10; CGFloat scrH = self.dataArr.count/2*height+self.dataArr.count%2*height; scrV.contentSize = CGSizeMake(0, scrH+100); [self.view addSubview:scrV]; NSInteger i = 0; for (NSDictionary *dic in self.dataArr) { ElePicView *p1 = [[[NSBundle mainBundle] loadNibNamed:@"ElePicView" owner:nil options:nil] lastObject]; p1.frame = CGRectMake(10+i%2*kSize.width/2, 10+(height+10)*(i/2), width, height-10); [p1.imgV sd_setImageWithURL:[NSURL URLWithString:dic[@"url"]] placeholderImage:[UIImage imageNamed:@"no_img"]]; p1.time.text = dic[@"sj"]; p1.clickBlock = ^(UIImage *img) { BigImgVC *vc = [[BigImgVC alloc]init]; vc.picType = @"1"; vc.picName = dic[@"url"]; vc.image = img; vc.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:vc animated:YES completion:nil]; }; [scrV addSubview:p1]; if ([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"17"]) { p1.msgLab.text = @"学员登录"; i++; }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"18"]){ p1.msgLab.text = @"学员登出"; i++; }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"19"]){ p1.msgLab.text = @"学员培训过程"; i++; }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"5"]){ p1.msgLab.text = @"定时拍照"; i++; }else { p1.msgLab.text = @"其它"; i++; } // i++; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #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. } */ @end