Blame view

App/listCtruong/VCPageImgs.swift 2.96 KB
1341bf603   Trịnh Văn Quân   version 1.1
1
2
3
4
5
6
  import UIKit
  import Foundation
  import GeneralUtils
  
  class VCPageImgs: BasePageViewController {
      var imgObjs: [ImgObj]!
fbd62afcf   Trịnh Văn Quân   version 1.2.2
7
8
9
      var cTruong: CongTruong!, shootItem: ShootItem!;
  
      static func openController(_ viewController: UIViewController, imgObjs: [ImgObj], cTruong: CongTruong, shootItem: ShootItem) {
1341bf603   Trịnh Văn Quân   version 1.1
10
11
12
          let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
          let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCPageImgs") as! VCPageImgs
          vcOpen.imgObjs = imgObjs
fbd62afcf   Trịnh Văn Quân   version 1.2.2
13
14
          vcOpen.cTruong = cTruong;
          vcOpen.shootItem = shootItem;
1341bf603   Trịnh Văn Quân   version 1.1
15
16
17
18
19
20
21
22
23
          viewController.present(vcOpen, animated: true, completion: nil)
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          setSelectionPage(0)
      }
  
      override func getViewControllerAtIndex(_ index: Int) -> UIViewController {
fbd62afcf   Trịnh Văn Quân   version 1.2.2
24
          let vc = VCImgItem.getInstance(imgObj: imgObjs[index], cTruong: self.cTruong, shootItem: self.shootItem)
1341bf603   Trịnh Văn Quân   version 1.1
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
          vc.pageIndex = index
          return vc
      }
  
      override func getCount() -> Int {
          return imgObjs.count
      }
  
      override var prefersStatusBarHidden: Bool {
          return true
      }
  
      override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
          return UIInterfaceOrientationMask.landscape
      }
  }
  
  
  class VCImgItem: UIViewController, BasePageContentViewController {
      @IBOutlet weak var imv: UIImageView!
  
      var pageIndex: Int = 0
      var imgObj: ImgObj!
fbd62afcf   Trịnh Văn Quân   version 1.2.2
48
49
      var cTruong: CongTruong!, shootItem: ShootItem!
      var vBoard: Board?
1341bf603   Trịnh Văn Quân   version 1.1
50

fbd62afcf   Trịnh Văn Quân   version 1.2.2
51
      static func getInstance(imgObj: ImgObj, cTruong: CongTruong, shootItem: ShootItem) -> VCImgItem {
1341bf603   Trịnh Văn Quân   version 1.1
52
53
54
          let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
          let vcOpen = storyboard.instantiateViewController(withIdentifier: "VCImgItem") as! VCImgItem
          vcOpen.imgObj = imgObj
fbd62afcf   Trịnh Văn Quân   version 1.2.2
55
56
          vcOpen.cTruong = cTruong;
          vcOpen.shootItem = shootItem;
1341bf603   Trịnh Văn Quân   version 1.1
57
58
59
60
61
62
          return vcOpen
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          setImageUrl(imv: imv, imageUrl: imgObj.url)
fbd62afcf   Trịnh Văn Quân   version 1.2.2
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
          configBoard()
      }
  
  
      fileprivate func configBoard() {
          if let imgObj = self.imgObj, let cTruong = self.cTruong, let singboard = imgObj.signBoard, singboard > 0 {
              let vBoard = Board()
              self.vBoard = vBoard;
              vBoard.translatesAutoresizingMaskIntoConstraints = false
              self.view.insertSubview(vBoard, at: 1)
              NSLayoutConstraint.activate([vBoard.topAnchor.constraint(equalTo: view.topAnchor),
                                           vBoard.leftAnchor.constraint(equalTo: view.leftAnchor),
                                           vBoard.rightAnchor.constraint(equalTo: view.rightAnchor),
                                           vBoard.bottomAnchor.constraint(equalTo: view.bottomAnchor)])
              vBoard.initData(ctruong: cTruong, shootItem: shootItem, imgObj: imgObj);
          }
1341bf603   Trịnh Văn Quân   version 1.1
79
      }
fbd62afcf   Trịnh Văn Quân   version 1.2.2
80

1341bf603   Trịnh Văn Quân   version 1.1
81
82
83
      @IBAction func btnCloseClick(_ sender: Any) {
          dismiss(animated: true)
      }
fbd62afcf   Trịnh Văn Quân   version 1.2.2
84

1341bf603   Trịnh Văn Quân   version 1.1
85
  }