首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >导航ios 8 swift?

导航ios 8 swift?
EN

Stack Overflow用户
提问于 2014-11-12 02:04:37
回答 2查看 62关注 0票数 0

我是IOS世界的新手。当我切换到一个只有在我登录时才能显示的新视图时,我在更改视图时遇到了麻烦。我在loginfuction中使用:

代码语言:javascript
复制
@IBAction func loginVerification(sender: UIButton!) {
        //Check with the cloud
        //temporary faking credentials

        var user = "n"
        var pass = "n"

        if usernameLogin.text == user &&
            passwordLogin.text == pass
        {
            println("Correct credentials")
            let homeviewcontroller = HomeViewController()

            self.presentViewController(homeviewcontroller, animated: true, completion: nil)


        }
        else
        {
            println("Wrong credentials!!")
        }
}

当我按下检查凭证的login按钮时,会触发上述功能。使用上面的线条使视图变为黑色。对如何让它工作有什么建议吗?关于视图之间的导航,有什么我可以遵循的教程吗?请不要对我这么苛刻:)

提前感谢!

EN

回答 2

Stack Overflow用户

发布于 2014-11-12 02:39:59

您好,我会尝试苹果教程-他们写得相当好,并有代码样本。这是我在学习的时候用到的:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html。本文特别介绍了如何使用故事板和Segues进行导航。如果您查看页面的左侧,您将看到其他教程的链接,这些教程在入门时可能会对您有所帮助。

票数 0
EN

Stack Overflow用户

发布于 2016-04-07 21:13:56

尝试以下代码:

代码语言:javascript
复制
let controller: homeviewcontroller = self.storyboard?.instantiateViewControllerWithIdentifier("homeviewcontroller") as! homeviewcontroller
            self.presentViewController(controller, animated: true, completion: nil) 

       @IBAction func loginVerification(sender: UIButton!) {
        //Check with the cloud
        //temporary faking credentials

        var user = "n"
        var pass = "n"

        if usernameLogin.text == user &&
            passwordLogin.text == pass
        {
            println("Correct credentials")

let controller: homeviewcontroller = self.storyboard?.instantiateViewControllerWithIdentifier("homeviewcontroller") as! homeviewcontroller
            self.presentViewController(controller, animated: true, completion: nil)
        }
        else
        {
            println("Wrong credentials!!")
        }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26871439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档