导航ios 8 swift?
我是IOS世界的新手。当我切换到一个新的视图时,我在更改视图时遇到问题,而这个视图只能在我登录时显示。我在登录功能中使用:导航ios 8 swift?,ios,swift,storyboard,Ios,Swift,Storyboard,我是IOS世界的新手。当我切换到一个新的视图时,我在更改视图时遇到问题,而这个视图只能在我登录时显示。我在登录功能中使用: @IBAction func loginVerification(sender: UIButton!) { //Check with the cloud //temporary faking credentials var user = "n" var pass = "n" if usern
@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!!")
}
}
当我按下检查凭证的登录按钮时,会触发上述功能。
使用上面的线可以使视图变黑。有没有关于如何让它工作的建议?我可以在视图之间导航的任何教程?请不要对我太苛刻:
提前谢谢 嗨,我想试试苹果教程——它们写得相当好,并且有代码示例。这是我在学习时使用的一个:。这一个是专门关于导航使用故事板和分段。如果您查看页面左侧,您将看到指向其他教程的链接,这些教程可能对您的入门有所帮助。请尝试以下代码:
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!!")
}
}
你听说过UINavigationController吗?检查以查找许多优秀的教程。