xcode - Display a view for few seconds (custom push from NavController) -
i started master-detail application. seek add together custom view (default uiviewcontroller simple label) displayed seconds (like loading view) before detail/master views accessible. problem if add together viewcontroller appdelegate , force navigationcontroller empty view. see here:
i didn't alter adding 1 line of code appdelegate:
func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. allow splitviewcontroller = self.window!.rootviewcontroller uisplitviewcontroller allow navigationcontroller = splitviewcontroller.viewcontrollers[splitviewcontroller.viewcontrollers.count-1] uinavigationcontroller navigationcontroller.topviewcontroller.navigationitem.leftbarbuttonitem = splitviewcontroller.displaymodebuttonitem() splitviewcontroller.delegate = self allow masternavigationcontroller = splitviewcontroller.viewcontrollers[0] uinavigationcontroller allow controller = masternavigationcontroller.topviewcontroller masterviewcontroller controller.managedobjectcontext = self.managedobjectcontext // +++ custom viewcontroller displayed here +++ navigationcontroller.pushviewcontroller(viewcontroller(), animated: true) homecoming true }
i not problem is...
with line in code
navigationcontroller.pushviewcontroller(viewcontroller(), animated: true)
you instantiating new, empty view controller, whis not want.
get reference storyboard (i.e masterviewcontroller) create view controller , force 1 on navigation stack. example:
if allow myvc = controller.storyboard!.instantiateviewcontrollerwithidentifier(...) { navigationcontroller.pushviewcontroller(myvc, animated: true) }
xcode view swift push navigationcontroller
No comments:
Post a Comment