SHARE
TWEET

InfoController

a guest Sep 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  InfoController.swift
  3. //  First screen
  4. //
  5. //  Created by karolis on 21/09/2019.
  6. //  Copyright © 2019 karolis. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class InfoController: UIViewController {
  12.    
  13.     let cellId = "cellId"
  14.     let headerId = "headerId"
  15.     let footerId = "footerId"
  16.    
  17.     let collectionView : UICollectionView = {
  18.         let layout = UICollectionViewFlowLayout()
  19.         layout.sectionHeadersPinToVisibleBounds = true
  20.         layout.minimumLineSpacing = 1
  21.         let collection = UICollectionView(frame: .zero, collectionViewLayout: layout)
  22.         collection.translatesAutoresizingMaskIntoConstraints = false
  23.         return collection
  24.     }()
  25.    
  26.     let MaterialsLabel: UILabel = {
  27.         let label = UILabel()
  28.         label.text = "Materials"
  29.         label.textColor = .black
  30.         label.font = label.font.withSize(20)
  31.         label.translatesAutoresizingMaskIntoConstraints = false
  32.         return label
  33.     }()
  34.    
  35.     let MATERIALSLabel: UILabel = {
  36.         let label = UILabel()
  37.         label.text = "MATERIALS"
  38.         label.font = UIFont.boldSystemFont(ofSize: 14)
  39.         label.translatesAutoresizingMaskIntoConstraints = false
  40.         return label
  41.     }()
  42.    
  43.     let ButtonPicLabel: UILabel = {
  44.         let label = UILabel()
  45.         label.text = ">>"
  46.         label.textColor = .blue
  47.         label.font = label.font.withSize(14)
  48.         //label.textAlignment = .center
  49.         //label.clipsToBounds = true
  50.         //label.layer.cornerRadius = 5
  51.         label.translatesAutoresizingMaskIntoConstraints = false
  52.         return label
  53.     }()
  54.    
  55.     let StatusLabel: UILabel = {
  56.         let label = UILabel()
  57.         label.text = "Status"
  58.         label.textColor = .black
  59.         label.font = label.font.withSize(10)
  60.         label.translatesAutoresizingMaskIntoConstraints = false
  61.         return label
  62.     }()
  63.    
  64.     let Date: UILabel = {
  65.         let label = UILabel()
  66.         label.text = "2019-08-21"
  67.         label.backgroundColor = .red
  68.         label.textColor = .black
  69.         label.font = label.font.withSize(10)
  70.         label.textAlignment = .center
  71.         label.clipsToBounds = true
  72.         label.layer.cornerRadius = 5
  73.         label.translatesAutoresizingMaskIntoConstraints = false
  74.         return label
  75.     }()
  76. //    let adressView: UIView = {
  77. //        let view = UIView()
  78. //        view.backgroundColor = .white
  79. //        view.layer.cornerRadius = 2
  80. //        view.translatesAutoresizingMaskIntoConstraints = false
  81. //        return view
  82. //    }()
  83.    
  84.     let filterVie: UIView = {
  85.         let view = UIView()
  86.         view.backgroundColor = .blue
  87.         view.translatesAutoresizingMaskIntoConstraints = false
  88.         return view
  89.     }()
  90.    
  91.     let filterLabel: UILabel = {
  92.         let label = UILabel()
  93.         label.textColor = .black
  94.         label.font = label.font.withSize(20)
  95.         label.textAlignment = .center
  96.         label.text = "Title:INC-694"
  97.         label.translatesAutoresizingMaskIntoConstraints = false
  98.         return label
  99.     }()
  100.    
  101.     let BlueLine: UIView = {
  102.         let view = UIView()
  103.         view.backgroundColor = .blue
  104.         view.layer.cornerRadius = 2
  105.         view.translatesAutoresizingMaskIntoConstraints = false
  106.         return view
  107.     }()
  108.    
  109.    
  110.    
  111.    
  112.     func setupView() {
  113.        
  114.         view.addSubview(filterVie)
  115.         view.addSubview(filterLabel)
  116.         view.addSubview(collectionView)
  117.         view.backgroundColor = .white
  118.         view.addSubview(MaterialsLabel)
  119.         view.addSubview(MATERIALSLabel)
  120.         view.addSubview(ButtonPicLabel)
  121.         view.addSubview(BlueLine)
  122.        
  123.        
  124.        
  125.         filterVie.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
  126.         filterVie.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
  127.         filterVie.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  128.         filterVie.heightAnchor.constraint(equalToConstant: 30).isActive = true
  129.        
  130.         filterLabel.topAnchor.constraint(equalTo: filterVie.topAnchor).isActive = true
  131.         filterLabel.leftAnchor.constraint(equalTo: filterVie.leftAnchor).isActive = true
  132.         filterLabel.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  133.         filterLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true
  134.        
  135.         MaterialsLabel.topAnchor.constraint(equalTo: filterVie.bottomAnchor).isActive = true
  136.         MaterialsLabel.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
  137.         MaterialsLabel.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  138.         MaterialsLabel.heightAnchor.constraint(equalToConstant: 40).isActive = true
  139.        
  140.         MATERIALSLabel.topAnchor.constraint(equalTo: MaterialsLabel.bottomAnchor).isActive = true
  141.         MATERIALSLabel.leftAnchor.constraint(equalTo: MaterialsLabel.leftAnchor).isActive = true
  142.         MATERIALSLabel.rightAnchor.constraint(equalTo: ButtonPicLabel.leftAnchor).isActive = true
  143.         MATERIALSLabel.bottomAnchor.constraint(equalTo: BlueLine.topAnchor).isActive = true
  144.        
  145.  
  146.         ButtonPicLabel.topAnchor.constraint(equalTo: MATERIALSLabel.bottomAnchor).isActive = true
  147.         ButtonPicLabel.bottomAnchor.constraint(equalTo: MATERIALSLabel.bottomAnchor).isActive = true
  148.         ButtonPicLabel.leftAnchor.constraint(equalTo: MaterialsLabel.rightAnchor).isActive = true
  149.         ButtonPicLabel.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  150.        
  151.         BlueLine.topAnchor.constraint(equalTo: MATERIALSLabel.bottomAnchor).isActive = true
  152.         BlueLine.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
  153.         BlueLine.heightAnchor.constraint(equalToConstant: 20).isActive = true
  154.        
  155.        
  156.        
  157. //
  158. //        StatusLabel.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
  159. //        StatusLabel.heightAnchor.constraint(equalToConstant: 20).isActive = true
  160. //        StatusLabel.leftAnchor.constraint(equalTo: workIdLabel.leftAnchor).isActive = true
  161. //        StatusLabel.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
  162.        
  163.        
  164.     }
  165.    
  166.  
  167.     override func viewDidLoad() {
  168.        
  169.         super.viewDidLoad()
  170.         setupView()
  171.        
  172.        
  173.         navigationItem.title = "Title:INC-694"
  174.    
  175.         collectionView.backgroundColor = .white
  176.         collectionView.dataSource = self
  177.         collectionView.delegate = self
  178.         collectionView.register(WordCell.self, forCellWithReuseIdentifier: cellId)
  179.        
  180.  
  181.     }
  182. }
  183.  
  184. extension InfoController : UICollectionViewDelegate {
  185.    
  186. }
  187.  
  188. extension InfoController : UICollectionViewDataSource {
  189.    
  190.     func numberOfSections(in collectionView: UICollectionView) -> Int {
  191.         return 1
  192.     }
  193.     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  194.         return 7
  195.     }
  196.    
  197.    
  198.     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  199.         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! WordCell
  200.        
  201.         return cell
  202.     }
  203.    
  204.    
  205. }
  206. extension InfoController : UICollectionViewDelegateFlowLayout  {
  207.    
  208.    
  209.     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  210.         return CGSize(width: collectionView.frame.width, height: 60)
  211.     }
  212. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top