diff --git a/iOS_Study_B.xcodeproj/project.pbxproj b/iOS_Study_B.xcodeproj/project.pbxproj index 9763af9..7dde90b 100644 --- a/iOS_Study_B.xcodeproj/project.pbxproj +++ b/iOS_Study_B.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 954B6B882AC57DAA00FDCFAB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B862AC57DAA00FDCFAB /* Main.storyboard */; }; 954B6B8A2AC57DAB00FDCFAB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B892AC57DAB00FDCFAB /* Assets.xcassets */; }; 954B6B8D2AC57DAB00FDCFAB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */; }; + CC1B9E5D2ADC5C600038B543 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC1B9E5C2ADC5C600038B543 /* SecondViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -24,6 +25,7 @@ 954B6B892AC57DAB00FDCFAB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 954B6B8C2AC57DAB00FDCFAB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 954B6B8E2AC57DAB00FDCFAB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CC1B9E5C2ADC5C600038B543 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,6 +62,7 @@ 954B6B822AC57DAA00FDCFAB /* SceneDelegate.swift */, 954B6B842AC57DAA00FDCFAB /* ViewController.swift */, 954B6B862AC57DAA00FDCFAB /* Main.storyboard */, + CC1B9E5C2ADC5C600038B543 /* SecondViewController.swift */, 954B6B892AC57DAB00FDCFAB /* Assets.xcassets */, 954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */, 954B6B8E2AC57DAB00FDCFAB /* Info.plist */, @@ -138,6 +141,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CC1B9E5D2ADC5C600038B543 /* SecondViewController.swift in Sources */, 954B6B852AC57DAA00FDCFAB /* ViewController.swift in Sources */, 954B6B812AC57DAA00FDCFAB /* AppDelegate.swift in Sources */, 954B6B832AC57DAA00FDCFAB /* SceneDelegate.swift in Sources */, diff --git a/iOS_Study_B/AppDelegate.swift b/iOS_Study_B/AppDelegate.swift index 65a81cc..297e684 100644 --- a/iOS_Study_B/AppDelegate.swift +++ b/iOS_Study_B/AppDelegate.swift @@ -11,7 +11,6 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true diff --git a/iOS_Study_B/Base.lproj/Main.storyboard b/iOS_Study_B/Base.lproj/Main.storyboard index 25a7638..f4d3147 100644 --- a/iOS_Study_B/Base.lproj/Main.storyboard +++ b/iOS_Study_B/Base.lproj/Main.storyboard @@ -1,24 +1,99 @@ - + + - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS_Study_B/SecondViewController.swift b/iOS_Study_B/SecondViewController.swift new file mode 100644 index 0000000..f4dca81 --- /dev/null +++ b/iOS_Study_B/SecondViewController.swift @@ -0,0 +1,45 @@ +// +// SecondViewController.swift +// iOS_Study_B +// +// Created by 임아영 on 2023/10/16. +// + +import UIKit + +class SecondViewController: UIViewController, ChangeLabelDelegate { + func doChange() { + previoisViewContRoller?.label.text = self.textfield.text + } + + + + @IBOutlet weak var textfield: UITextField! + var previoisViewContRoller : ViewController? + + + @IBAction func ButtonDismiss(_ sender: Any) { + doChange() + dismiss(animated: true, completion: nil) + } + + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + previoisViewContRoller?.delegate = self + } + + + /* + // 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.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/iOS_Study_B/ViewController.swift b/iOS_Study_B/ViewController.swift index f3577b5..9036bcb 100644 --- a/iOS_Study_B/ViewController.swift +++ b/iOS_Study_B/ViewController.swift @@ -7,13 +7,32 @@ import UIKit -class ViewController: UIViewController { +protocol ChangeLabelDelegate{ + func doChange() +} +class ViewController: UIViewController { + + @IBOutlet weak var label: UILabel! + + @IBAction func buttongonextVC(_ sender: Any) { + guard let nextVC = storyboard?.instantiateViewController(withIdentifier: "SecondViewController")as? SecondViewController else { + return + } + + nextVC.previoisViewContRoller = self + nextVC.modalPresentationStyle = .fullScreen + present(nextVC, animated: true, completion: nil) + } + + var delegate : ChangeLabelDelegate? + + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } - - + + + } -