Case:
I have an app which holds a TabBarcontroller
, in that TBC
i have a NavigationController
. I want to add ApplicationShortcuts
in this app.
However one of them needs to be on tab 1, and 4 segue's down the line in the navigation controller. How do i achieve this?
I am able to get to the first one by using NSNotificationCenter
and using a listener on the first layer. But this requires my app the be opened before.. Trying to send another notification fails..
My storyboard:
From variable controller -> Navigation controller -> Table View(year-- opens here) -> Table View(period-- can get here if app was opened before) -> Table View(week) -> Picker view. ( finish)
Which function should i use to achieve desired goal?
After hours i found out how to do the above.
In main class ViewDidLoad:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "quickActions:", name: "quickAction", object: nil)
Then a listener:
func quickActions(notification: NSNotification){
print(notification.userInfo!)
varDec.pressedYear = "2016" //used for the right year. (dynamical)
varDec.pressedWeek = "13" //Used to show the right dates.
let VC1 = self.storyboard!.instantiateViewControllerWithIdentifier("weekViewController") as! UIViewController
self.navigationController!.pushViewController(VC1, animated: true)
}
Making me eligible to navigate to any ViewController without losing my UINavigationController