modal 방식
navigation controller 추가한 push 방식
//
// FirstViewController.swift
// ai 11
//
// Created by stayfoolish on 2018. 9. 19..
// Copyright © 2018년 stayfoolish. All rights reserved.
//
import UIKit
class FirstViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func buttonPressed(_ sender: UIButton) {
self.performSegue(withIdentifier: "goToSecondViewController", sender: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
//
// SecondViewController.swift
// ai 11
//
// Created by stayfoolish on 2018. 9. 19..
// Copyright © 2018년 stayfoolish. All rights reserved.
//
import UIKit
class SecondViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func goBack(_ sender: UIButton) {
self.dismiss(animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
'Swift > 기초&문법' 카테고리의 다른 글
swift custom tableview 스위프트 커스텀 테이블뷰 (0) | 2018.09.20 |
---|---|
swift tableview 스위프트 테이블뷰 data array (0) | 2018.09.20 |
스위프트 swift 인스턴스 생성 소멸 (0) | 2018.09.04 |
스위프트 swift 상속 (0) | 2018.09.03 |
스위프트 swift 프로퍼티 property (0) | 2018.08.31 |