Guest User

Untitled

a guest
May 28th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. import UIKit
  2.  
  3. //MARK:- ConfirmationView
  4. /**
  5. This Class is used to show a common View for limited time
  6. */
  7. class ConfirmationView: UIView
  8. {
  9. //MARK: UIView
  10. /// Main Content View
  11. @IBOutlet var contentView: UIView!
  12.  
  13. //MARK: UILabel
  14. /// Title to display in View
  15. @IBOutlet weak var headerLabel: UILabel!
  16.  
  17. //MARK: Init Class
  18. /**
  19. This function is used to Initialise the class
  20. */
  21. override init(frame: CGRect) {
  22. super.init(frame: frame)
  23. loadNib()
  24. }
  25.  
  26. //MARK: Encoder
  27. /**
  28. This function is used to Store the class objects added
  29. */
  30. required init?(coder aDecoder: NSCoder) {
  31. super.init(coder: aDecoder)
  32. loadNib()
  33. }
  34.  
  35. //MARK: Dienit class
  36. /**
  37. This function is used to De-Allocate the class objects
  38. */
  39. deinit {
  40. /// Remove all The Initiated Instances
  41. }
  42. }
  43.  
  44. //MARK:- Required Functions
  45. extension ConfirmationView
  46. {
  47. //MARK: Load Nib
  48. /**
  49. This function is used to load the Nib from Bundle
  50. */
  51. func loadNib() {
  52. Bundle.main.loadNibNamed("ConfirmationView", owner: self, options: [:])
  53. // 2. Adding the 'contentView' to self (self represents the instance of a WeatherView which is a 'UIView').
  54. addSubview(contentView)
  55. // 3. Setting this false allows us to set our constraints on the contentView programtically
  56. contentView.translatesAutoresizingMaskIntoConstraints = false
  57. contentView.backgroundColor = UIColor.clear
  58. // 4. Setting the constraints programatically
  59. contentView.topAnchor.constraint(equalTo: topAnchor).isActive = true
  60. contentView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
  61. contentView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
  62. contentView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
  63. }
  64. }
  65.  
  66. ///Create a Reference for XIB
  67.  
  68. /// Confirmation View Xib Class Reference
  69. private var confirmationViewXib : ConfirmationView?
  70.  
  71. confirmationViewXib = self.showConfirmationView(staticText: "Sign Up Completed using (loginType)")
  72. self.view.addSubview(confirmationViewXib!)
Add Comment
Please, Sign In to add comment