Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Navigate to another view from Appdelegate trough a UIButton

I have the following issue. I have made a UIButton in my Appdelegate and i want that button navigate me to another ViewController. I already made a connection from my Storyboard, this connection is a type Modal Segue. I thought that performSegueWithIdentifier will do the job but it gives me the following error "has no segue with identifier 'showCamera' ". And im pretty sure that i have made that Identifier trough the Storyboard.

let camera = UIButton.buttonWithType(UIButtonType.Custom) as UIButton
     camera.addTarget(self, action: "takePicture:", forControlEvents: .TouchUpInside);

    //this function works 
    func takePicture(sender: UIButton!){
        println("Open Camera")

    //this throws an error        

self.window?.rootViewController?.performSegueWithIdentifier("showCamera", sender: self) 
        }

I would be very gratefull if someone can help me out with this.

Please post all code from your app delegate