ios - Performing Segue using code gives shows black screen -


i trying segue screen using code shows me black screen using xcode 7 beta 6. here 1st view controller file code

//  viewcontroller.swift //  segue through programming //  import uikit  class viewcontroller: uiviewcontroller{      @ibaction func buttonpressed(sender: anyobject) {         presentviewcontroller(secondcontroller(), animated: true) { () -> void in          }     }      override func viewdidload() {         super.viewdidload()         // additional setup after loading view, typically nib.     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }  } 

this work if secondcontroller programmatically creates view. if want use storyboard scene (which far more common), can following:

@ibaction func buttonpressed(sender: anyobject) {     let controller = storyboard?.instantiateviewcontrollerwithidentifier("foo")     presentviewcontroller(controller!, animated: true, completion: nil) } 

that assumes you've specified storyboard identifier destination scene.

enter image description here

or, can created segue between 2 scenes in ib control dragging view controller icon @ top of first scene second scene:

enter image description here

and give segue own storyboard id:

enter image description here

then can invoke segue programmatically:

@ibaction func buttonpressed(sender: anyobject) {     performseguewithidentifier("bar", sender: self) } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -