본문 바로가기

iOS/swift

[swift] ViewController간 이동

반응형
class ViewController : UIViewController {
 func moveToSignIn(_ sender: Any) {
  let signInVC = UIStoryboard(name: "SignInVC", bundle: nil).instantiateViewController(withIdentifier: "signInVC")

 self.present(signInVC, animated: true, completion: nil)
 }
}
class SignInViewController: UIViewController {
 dismissVC(_ sender: Any) {
 self.dismiss(animated: true, completion: nil)
 }
}

 

buttonSignIn.layer.cornerRadius = buttonSignIn.bounds.size.height / 2
buttonSignIn.layer.borderWidth = 1
buttonSignIn.layer.borderColor = UIColor.blue.cgColor

----------------------------
class ViewController : UIViewController {
 func moveToSignIn(_ sender: Any) {
  let signInVC = UIStoryboard(name: "SignInVC", bundle: nil).instantiateViewController(withIdentifier: "naviSignIn")
 }


class SignInViewController: UIViewController {
 override func viewDidLoad() {
  self.navigationController?.setNavigationBarHidden(true, false)

 }

 

 funcmoveToSignUp(_ sender: Any) {
  let signInVC = UIStoryboard(name: "SignUpVC", bundle: nil).instantiateViewController(withIdentifier: "SignUpVC")
  self.navigationController?.pushViewController(signUpVC, animated: true)
 }
}

 

class SignUpViewController: UIViewController {
 @IBAction func popVC(_ sender: Any) {
  self.navigationController?.popViewController(animated: true)
 }
}
반응형

'iOS > swift' 카테고리의 다른 글

GCD(Grand Central Patch)  (0) 2020.07.18
URLSession  (0) 2020.07.04
Swift error: missing argument label 'name:' in call  (0) 2020.06.08
네트워크  (0) 2020.04.30
xcode에서 iPhone연결하기  (0) 2020.04.26

]