From 91e0224c2adc95628119b03f0e774612f09ea7df Mon Sep 17 00:00:00 2001 From: Sonjh1306 Date: Fri, 7 May 2021 13:54:58 +0900 Subject: [PATCH] [#12] feat: Create PlayerInformationCell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 커스텀 셀 생성 --- .../Baseball.xcodeproj/project.pbxproj | 8 ++ .../Baseball/Base.lproj/Main.storyboard | 1 + .../Controller/ScoresViewController.swift | 24 +++++- .../Baseball/View/PlayerInformationCell.swift | 35 +++++++++ .../Baseball/View/PlayerInformationCell.xib | 75 +++++++++++++++++++ 5 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 iOS/Baseball/Baseball/View/PlayerInformationCell.swift create mode 100644 iOS/Baseball/Baseball/View/PlayerInformationCell.xib diff --git a/iOS/Baseball/Baseball.xcodeproj/project.pbxproj b/iOS/Baseball/Baseball.xcodeproj/project.pbxproj index cd4bebd9b..fad0f589a 100644 --- a/iOS/Baseball/Baseball.xcodeproj/project.pbxproj +++ b/iOS/Baseball/Baseball.xcodeproj/project.pbxproj @@ -10,6 +10,8 @@ 5D20A1F19F0A2A6887D836D2 /* Pods_BaseballTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 102C0D74D62A888453D26388 /* Pods_BaseballTests.framework */; }; BD8A23742643C4E400828432 /* DTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8A23732643C4E400828432 /* DTO.swift */; }; BD8A23772643C73A00828432 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8A23762643C73A00828432 /* Network.swift */; }; + BD8A237A2644F8EB00828432 /* PlayerInformationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8A23782644F8EB00828432 /* PlayerInformationCell.swift */; }; + BD8A237B2644F8EB00828432 /* PlayerInformationCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BD8A23792644F8EB00828432 /* PlayerInformationCell.xib */; }; D4A2CB682640E4FD0019AFB6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */; }; D4A2CB6A2640E4FD0019AFB6 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */; }; D4A2CB6C2640E4FD0019AFB6 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */; }; @@ -58,6 +60,8 @@ 9F92A719088DE201B3531AAD /* Pods-BaseballTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BaseballTests.release.xcconfig"; path = "Target Support Files/Pods-BaseballTests/Pods-BaseballTests.release.xcconfig"; sourceTree = ""; }; BD8A23732643C4E400828432 /* DTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DTO.swift; sourceTree = ""; }; BD8A23762643C73A00828432 /* Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = ""; }; + BD8A23782644F8EB00828432 /* PlayerInformationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerInformationCell.swift; sourceTree = ""; }; + BD8A23792644F8EB00828432 /* PlayerInformationCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlayerInformationCell.xib; sourceTree = ""; }; D159143F731D8C2D8DDBDE86 /* Pods_Baseball.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Baseball.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D4A2CB642640E4FD0019AFB6 /* Baseball.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Baseball.app; sourceTree = BUILT_PRODUCTS_DIR; }; D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -150,6 +154,8 @@ children = ( D4A2CB9A2640E5E60019AFB6 /* GameListCell.swift */, D4A2CB9B2640E5E60019AFB6 /* GameListCell.xib */, + BD8A23782644F8EB00828432 /* PlayerInformationCell.swift */, + BD8A23792644F8EB00828432 /* PlayerInformationCell.xib */, ); path = View; sourceTree = ""; @@ -366,6 +372,7 @@ buildActionMask = 2147483647; files = ( D4A2CB742640E4FF0019AFB6 /* LaunchScreen.storyboard in Resources */, + BD8A237B2644F8EB00828432 /* PlayerInformationCell.xib in Resources */, D4A2CB712640E4FF0019AFB6 /* Assets.xcassets in Resources */, D4A2CB6F2640E4FD0019AFB6 /* Main.storyboard in Resources */, D4A2CB9D2640E5E60019AFB6 /* GameListCell.xib in Resources */, @@ -503,6 +510,7 @@ D4A2CBC32643DDD00019AFB6 /* EndPoint.swift in Sources */, D4A2CBD8264414B30019AFB6 /* FetchGameList.swift in Sources */, D4A2CBC8264405400019AFB6 /* FetchGame.swift in Sources */, + BD8A237A2644F8EB00828432 /* PlayerInformationCell.swift in Sources */, D4A2CB682640E4FD0019AFB6 /* AppDelegate.swift in Sources */, BD8A23742643C4E400828432 /* DTO.swift in Sources */, D4A2CBD3264412B40019AFB6 /* GameListViewModel.swift in Sources */, diff --git a/iOS/Baseball/Baseball/Base.lproj/Main.storyboard b/iOS/Baseball/Baseball/Base.lproj/Main.storyboard index d4379bb4b..a74ea9e6e 100644 --- a/iOS/Baseball/Baseball/Base.lproj/Main.storyboard +++ b/iOS/Baseball/Baseball/Base.lproj/Main.storyboard @@ -784,6 +784,7 @@ + diff --git a/iOS/Baseball/Baseball/Controller/ScoresViewController.swift b/iOS/Baseball/Baseball/Controller/ScoresViewController.swift index 7a78e3978..d6e908662 100644 --- a/iOS/Baseball/Baseball/Controller/ScoresViewController.swift +++ b/iOS/Baseball/Baseball/Controller/ScoresViewController.swift @@ -11,12 +11,34 @@ class ScoresViewController: UIViewController { @IBOutlet var awayScoreLabel: [UILabel]! @IBOutlet var homeScoreLabel: [UILabel]! + @IBOutlet weak var playerInformationTableView: UITableView! override func viewDidLoad() { super.viewDidLoad() - + self.playerInformationTableView.delegate = self + self.playerInformationTableView.dataSource = self + self.playerInformationTableView.register(PlayerInformationCell.nib, forCellReuseIdentifier: PlayerInformationCell.identifier) } } + +extension ScoresViewController: UITableViewDelegate { + +} + +extension ScoresViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 7 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: PlayerInformationCell.identifier, for: indexPath) as? PlayerInformationCell else { + return PlayerInformationCell() + } + return cell + } + + +} diff --git a/iOS/Baseball/Baseball/View/PlayerInformationCell.swift b/iOS/Baseball/Baseball/View/PlayerInformationCell.swift new file mode 100644 index 000000000..0c83eb418 --- /dev/null +++ b/iOS/Baseball/Baseball/View/PlayerInformationCell.swift @@ -0,0 +1,35 @@ +// +// PlayerInformationCell.swift +// Baseball +// +// Created by sonjuhyeong on 2021/05/07. +// + +import UIKit + +class PlayerInformationCell: UITableViewCell { + + @IBOutlet weak var nameLabel: UILabel! + @IBOutlet weak var atBatLabel: UILabel! + @IBOutlet weak var hitLabel: UILabel! + @IBOutlet weak var outLabel: UILabel! + @IBOutlet weak var battingAverageLabel: UILabel! + + static let identifier = "PlayerInformationCell" + + override func awakeFromNib() { + super.awakeFromNib() + + } + + static var nib: UINib { + return UINib(nibName: identifier, bundle: nil) + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + } + + + +} diff --git a/iOS/Baseball/Baseball/View/PlayerInformationCell.xib b/iOS/Baseball/Baseball/View/PlayerInformationCell.xib new file mode 100644 index 000000000..d8665443b --- /dev/null +++ b/iOS/Baseball/Baseball/View/PlayerInformationCell.xib @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +