Guest User

Untitled

a guest
Dec 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. //
  2. // ViewController.swift
  3. // iOS MVVM
  4. //
  5. // Created by Mengheang Rat on 12/16/18.
  6. // Copyright © 2018. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class ViewController: UIViewController, OrientationMaskable {
  12.  
  13. // Mark: you have to with OrientationMaskable protocol
  14. var appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
  15.  
  16.  
  17. override func viewDidLoad() {
  18. super.viewDidLoad()
  19.  
  20. // Do any additional setup after loading the view.
  21. }
  22.  
  23. override func viewWillAppear(_ animated: Bool) {
  24. // you want to rotation up down, portrait when you are in video player view (Facebook)
  25. self.orientationAll()
  26. }
  27.  
  28. override func viewDidDisappear(_ animated: Bool) {
  29. // you want to lock rotation to portrait only when you go back to another view
  30. self.orientationPortrait()
  31. }
  32. }
Add Comment
Please, Sign In to add comment