Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save licvido/87c1eee32b90b44d0b7e2fa09ea63cc7 to your computer and use it in GitHub Desktop.

Select an option

Save licvido/87c1eee32b90b44d0b7e2fa09ea63cc7 to your computer and use it in GitHub Desktop.

Revisions

  1. licvido revised this gist Dec 15, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.swift
    Original file line number Diff line number Diff line change
    @@ -16,3 +16,6 @@
    }
    // 5. That's all

    //
    // Another article here - http://stackoverflow.com/questions/31053488/how-to-open-a-modal-with-uitabbarcontroller-and-on-close-display-last-tab-bar-v
    //
  2. @wavecos wavecos created this gist Jan 28, 2015.
    18 changes: 18 additions & 0 deletions gistfile1.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    // 1. First Create a Dummy UIViewController that has a root relation with the UITabBarController
    // 2. Make this controller implement a UITabBarControllerDelegate
    // 3. In ViewDidLoad:
    override func viewDidLoad() {
    super.viewDidLoad()
    self.tabBarController?.delegate = self
    }
    // 4. Implement this delegate method:
    func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
    let isModalTab = viewController == self

    if isModalTab {
    let cameraVC = UIStoryboard.cameraVC() // 5. HERE YOU SPECIFY THE MODAL VIEW CONTROLLER!!!
    self.presentViewController(cameraVC, animated: true, completion: nil)
    }
    }
    // 5. That's all