Skip to content

Commit

Permalink
[#12] feat: Create PlayerInformationCell
Browse files Browse the repository at this point in the history
커스텀 셀 생성
  • Loading branch information
Sonjh1306 committed May 7, 2021
1 parent b158104 commit 91e0224
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 1 deletion.
8 changes: 8 additions & 0 deletions iOS/Baseball/Baseball.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
BD8A23732643C4E400828432 /* DTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DTO.swift; sourceTree = "<group>"; };
BD8A23762643C73A00828432 /* Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; };
BD8A23782644F8EB00828432 /* PlayerInformationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerInformationCell.swift; sourceTree = "<group>"; };
BD8A23792644F8EB00828432 /* PlayerInformationCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlayerInformationCell.xib; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -150,6 +154,8 @@
children = (
D4A2CB9A2640E5E60019AFB6 /* GameListCell.swift */,
D4A2CB9B2640E5E60019AFB6 /* GameListCell.xib */,
BD8A23782644F8EB00828432 /* PlayerInformationCell.swift */,
BD8A23792644F8EB00828432 /* PlayerInformationCell.xib */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
1 change: 1 addition & 0 deletions iOS/Baseball/Baseball/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@
</view>
<tabBarItem key="tabBarItem" title="Scores" image="rectangle.and.pencil.and.ellipsis" catalog="system" id="G7D-V1-rtW"/>
<connections>
<outlet property="playerInformationTableView" destination="fjD-td-ywJ" id="gAJ-w5-sbM"/>
<outletCollection property="awayScoreLabel" destination="Q5O-bT-iL9" collectionClass="NSMutableArray" id="vp3-Ej-NLY"/>
<outletCollection property="homeScoreLabel" destination="3ch-Dq-SYi" collectionClass="NSMutableArray" id="vdU-A2-yiR"/>
<outletCollection property="awayScoreLabel" destination="8eX-iQ-sBa" collectionClass="NSMutableArray" id="YN5-FN-eiX"/>
Expand Down
24 changes: 23 additions & 1 deletion iOS/Baseball/Baseball/Controller/ScoresViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


}
35 changes: 35 additions & 0 deletions iOS/Baseball/Baseball/View/PlayerInformationCell.swift
Original file line number Diff line number Diff line change
@@ -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)
}



}
75 changes: 75 additions & 0 deletions iOS/Baseball/Baseball/View/PlayerInformationCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="43" id="KGk-i7-Jjw" customClass="PlayerInformationCell" customModule="Baseball" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="392" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="392" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="김광진" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x5a-iI-0Zr">
<rect key="frame" x="15" y="11" width="44.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Cuj-R6-pRc">
<rect key="frame" x="160" y="11" width="7.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5zi-ql-dIz">
<rect key="frame" x="217.5" y="11" width="7.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VcI-RR-0NX">
<rect key="frame" x="275" y="11" width="7.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0.003" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KA2-3Z-PRB">
<rect key="frame" x="332.5" y="11" width="44.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="Cuj-R6-pRc" firstAttribute="leading" relation="lessThanOrEqual" secondItem="x5a-iI-0Zr" secondAttribute="trailing" constant="100.5" id="1cq-0P-qc2"/>
<constraint firstItem="x5a-iI-0Zr" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Akm-a9-jGu"/>
<constraint firstItem="VcI-RR-0NX" firstAttribute="leading" secondItem="5zi-ql-dIz" secondAttribute="trailing" constant="50" id="SZr-Fn-0JE"/>
<constraint firstItem="Cuj-R6-pRc" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="e8z-Oj-suc"/>
<constraint firstItem="KA2-3Z-PRB" firstAttribute="leading" secondItem="VcI-RR-0NX" secondAttribute="trailing" constant="50" id="fqZ-qi-fzz"/>
<constraint firstItem="KA2-3Z-PRB" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="fxR-7T-aTW"/>
<constraint firstAttribute="trailing" secondItem="KA2-3Z-PRB" secondAttribute="trailing" constant="15" id="hlC-Qj-rIb"/>
<constraint firstItem="x5a-iI-0Zr" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="hlT-ue-6uu"/>
<constraint firstItem="VcI-RR-0NX" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="pmp-kJ-4B4"/>
<constraint firstItem="5zi-ql-dIz" firstAttribute="leading" secondItem="Cuj-R6-pRc" secondAttribute="trailing" constant="50" id="rwV-nO-U3R"/>
<constraint firstItem="5zi-ql-dIz" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="ydI-yz-fgi"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="atBatLabel" destination="Cuj-R6-pRc" id="CXX-lN-YEY"/>
<outlet property="battingAverageLabel" destination="KA2-3Z-PRB" id="jiu-Dj-wXp"/>
<outlet property="hitLabel" destination="5zi-ql-dIz" id="jpI-xp-3Ck"/>
<outlet property="nameLabel" destination="x5a-iI-0Zr" id="ccq-Me-UIn"/>
<outlet property="outLabel" destination="VcI-RR-0NX" id="psH-Ot-DL6"/>
</connections>
<point key="canvasLocation" x="184.05797101449278" y="120.20089285714285"/>
</tableViewCell>
</objects>
</document>

0 comments on commit 91e0224

Please sign in to comment.