我对swift和ios非常陌生,所以我需要对以下概念进行清理
我创建了一个视图,其中一个按钮具有后退箭头的背景图像,按钮操作我将返回到之前的控制器,即登录,这样做是否安全,而不是使用NavigationController?
@IBAction func onBackPressed(sender: AnyObject) { let aaa : Login = self.storyboard?.instantiateViewControllerWithIdentifier("Login") as! Login self.presentViewController(aaa, animated: true, completion: nil) }谢谢
I am very much new to swift and ios so i need my doubts to be cleared for the below concept
I have created a view with a button having background image of back arrow and on button action i am going back to the previous controller which is the Login, is it safe to do it this way instead of using NavigationController??
@IBAction func onBackPressed(sender: AnyObject) { let aaa : Login = self.storyboard?.instantiateViewControllerWithIdentifier("Login") as! Login self.presentViewController(aaa, animated: true, completion: nil) }Thanks
最满意答案
当您想要推送到下一个View Controller时,导航控制器是最佳选择。
(即)导航控制器 - >视图控制器 - >视图控制器[推送]。
所以我的建议是,如果你想回到以前的视图控制器使用导航控制器
当您想要提供新的View Controller时 ,不需要时间。
Navigation controller is best when you want to push to next View Controller.
(i.e) Navigation Controller ->View Controller ->View Controller[for Push].
So my suggestion is if you want to come back to previous view controller use Navigation Controller
When you want to present a new View Controller that time no need.
更多推荐
发布评论