2016-03-23 6 views
1

enter image description hereIn IBAction:

Von dem, was ich der beste Weg, habe gesehen, „Argumente übergeben, die keine Argumente nimmt nennen“, um diesen Fehler zu beheben:

arguments passed to call that takes no arguments

wird

verwenden
do {try ...} and catch {...} 

Es scheint jedoch unmöglich, es in diesem Code zu implementieren!

@IBAction func onTapButton(sender: AnyObject) { 

    btnFromNib.animate(1, completion: {() ->() in 

     var myTabbarController = self.storyboard?.instantiateInitialViewController("myTabbarController") as! UITabBarController 
     var appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate 
     appDelegate.window?.rootViewController = myTabbarController 

     myTabbarController.transitioningDelegate = self 

     self.presentViewController(myTabbarController, animated: true, completion: nil) 
    }) 

} 
+0

Das funktionierte ... Danke –

Antwort

0

Sie versuchen, einen View-Controller mit einer Kennung Parameter für diese, aber Sie sind nicht mit der richtigen Methode zu instanziieren.

Sie sollten instantiateViewControllerWithIdentifier anstelle von instantiateInitialViewController verwenden.

Referenz: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIStoryboard_Class/index.html#//apple_ref/occ/instm/UIStoryboard/instantiateViewControllerWithIdentifier:

Instantiates and returns the view controller with the specified identifier.

You use this method to create view controller objects that you want to manipulate and present programmatically in your application. Before you can use this method to retrieve a view controller, you must explicitly tag it with an appropriate identifier string in Interface Builder.

This method creates a new instance of the specified view controller each time you call it.

+0

@ Eric D. Obwohl das, erhalte ich die Gegend Debug heute Morgen ad gearbeitet: deren Ansicht ist in der Fensterhierarchie nicht! Irgendeine Idee? –

+0

Keine Ahnung, tut mir leid. Es sieht so aus, als wäre es ein anderes Thema. – Moritz