ElePictureVC.m 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // ElePictureVC.m
  3. // JSJPCoach
  4. //
  5. // Created by EchoShacolee on 2018/1/31.
  6. // Copyright © 2018年 Danson. All rights reserved.
  7. //
  8. #import "ElePictureVC.h"
  9. #import "ElePicView.h"
  10. #import "BigImgVC.h"
  11. @interface ElePictureVC ()
  12. @end
  13. @implementation ElePictureVC
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.view.backgroundColor = backGroundColor;
  17. UIScrollView *scrV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-40-kNavOffSet)];
  18. CGFloat width = kSize.width/2-20;
  19. CGFloat height = width+50+10;
  20. CGFloat scrH = self.dataArr.count/2*height+self.dataArr.count%2*height;
  21. scrV.contentSize = CGSizeMake(0, scrH+100);
  22. [self.view addSubview:scrV];
  23. NSInteger i = 0;
  24. for (NSDictionary *dic in self.dataArr) {
  25. ElePicView *p1 = [[[NSBundle mainBundle] loadNibNamed:@"ElePicView" owner:nil options:nil] lastObject];
  26. p1.frame = CGRectMake(10+i%2*kSize.width/2, 10+(height+10)*(i/2), width, height-10);
  27. [p1.imgV sd_setImageWithURL:[NSURL URLWithString:dic[@"url"]] placeholderImage:[UIImage imageNamed:@"no_img"]];
  28. p1.time.text = dic[@"sj"];
  29. p1.clickBlock = ^(UIImage *img) {
  30. BigImgVC *vc = [[BigImgVC alloc]init];
  31. vc.picType = @"1";
  32. vc.picName = dic[@"url"];
  33. vc.image = img;
  34. vc.modalPresentationStyle = UIModalPresentationFullScreen;
  35. [self presentViewController:vc animated:YES completion:nil];
  36. };
  37. [scrV addSubview:p1];
  38. if ([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"17"]) {
  39. p1.msgLab.text = @"学员登录";
  40. i++;
  41. }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"18"]){
  42. p1.msgLab.text = @"学员登出";
  43. i++;
  44. }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"19"]){
  45. p1.msgLab.text = @"学员培训过程";
  46. i++;
  47. }else if([[NSString stringWithFormat:@"%@",dic[@"event"]] isEqualToString:@"5"]){
  48. p1.msgLab.text = @"定时拍照";
  49. i++;
  50. }else {
  51. p1.msgLab.text = @"其它";
  52. i++;
  53. }
  54. // i++;
  55. }
  56. }
  57. - (void)didReceiveMemoryWarning {
  58. [super didReceiveMemoryWarning];
  59. // Dispose of any resources that can be recreated.
  60. }
  61. /*
  62. #pragma mark - Navigation
  63. // In a storyboard-based application, you will often want to do a little preparation before navigation
  64. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  65. // Get the new view controller using [segue destinationViewController].
  66. // Pass the selected object to the new view controller.
  67. }
  68. */
  69. @end