ios - Getting Extra argument 'animated' in call -
when seek go storyboard programmatically utilize
//pop user next screen allow storyboard = uistoryboard(name: "homeviewcontroller", bundle: nil); allow vc = storyboard.instantiateviewcontrollerwithidentifier("home") uiviewcontroller; self.presentviewcontroller(vc, animated: true, completion: nil); but doesn't show navigation controller on next story board. did
homeviewcontroller.presentviewcontroller(vc, animated: true, completion: nil); and throws
extra argument 'animated' in call
any ideas?
a couple of observations regarding first question:
for first issue, might want create sure vc not nil (e.g. scene storyboard id of home found):
if allow vc = storyboard.instantiateviewcontrollerwithidentifier("home") as? uiviewcontroller { presentviewcontroller(vc, animated: true, completion: nil) } else { println("home not found") } i'd suggest double check spelling , capitalization "storyboard id" "home" scene.
btw, if you've checked "is initial view controller" checkbox in ib first scene in sec storyboard, can alternatively do:
let vc = storyboard.instantiateinitialviewcontroller() you can visually confirm setting because scene have little "initial segue" arrow pointing left:
if doing presentviewcontroller destination scene is, itself, itself, embedded in navigation controller, should nowadays navigation controller (i.e. give navigation controller's scene "storyboard id" or specify "is initial view controller"), rather scene embedded within navigation controller.
regarding sec error, that's because you're calling instance method presentviewcontroller, referencing presumably class name, homeviewcontroller, rather instance. syntax doesn't create sense @ all.
the former syntax self.presentviewcontroller(...) right, more storyboard or scene not found, either because name of 1 or other (most scene's "storyboard id") or because scoreboard not included in bundle (though think have generated different error).
ios xcode swift
No comments:
Post a Comment