Skip to content

Commit

Permalink
[#2] 메인뷰 UI
Browse files Browse the repository at this point in the history
  • Loading branch information
hyesuuou committed Sep 12, 2021
1 parent 6a43181 commit f1a2947
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 27 deletions.
20 changes: 16 additions & 4 deletions AppleContacts/AppleContacts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@
/* Begin PBXBuildFile section */
15A3B50526EE147B00A57ADD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B50426EE147B00A57ADD /* AppDelegate.swift */; };
15A3B50726EE147B00A57ADD /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B50626EE147B00A57ADD /* SceneDelegate.swift */; };
15A3B50926EE147B00A57ADD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B50826EE147B00A57ADD /* ViewController.swift */; };
15A3B50C26EE147B00A57ADD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15A3B50A26EE147B00A57ADD /* Main.storyboard */; };
15A3B50F26EE147B00A57ADD /* AppleContacts.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B50D26EE147B00A57ADD /* AppleContacts.xcdatamodeld */; };
15A3B51126EE147B00A57ADD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 15A3B51026EE147B00A57ADD /* Assets.xcassets */; };
15A3B51426EE147B00A57ADD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15A3B51226EE147B00A57ADD /* LaunchScreen.storyboard */; };
15A3B51F26EE16B900A57ADD /* MainVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B51E26EE16B900A57ADD /* MainVC.swift */; };
15A3B52226EE19F000A57ADD /* MainNameTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A3B52126EE19F000A57ADD /* MainNameTVC.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
15A3B50126EE147B00A57ADD /* AppleContacts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AppleContacts.app; sourceTree = BUILT_PRODUCTS_DIR; };
15A3B50426EE147B00A57ADD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
15A3B50626EE147B00A57ADD /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
15A3B50826EE147B00A57ADD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
15A3B50B26EE147B00A57ADD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
15A3B50E26EE147B00A57ADD /* AppleContacts.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = AppleContacts.xcdatamodel; sourceTree = "<group>"; };
15A3B51026EE147B00A57ADD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
15A3B51326EE147B00A57ADD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
15A3B51526EE147B00A57ADD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
15A3B51E26EE16B900A57ADD /* MainVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainVC.swift; sourceTree = "<group>"; };
15A3B52126EE19F000A57ADD /* MainNameTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainNameTVC.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -89,11 +91,20 @@
isa = PBXGroup;
children = (
15A3B50A26EE147B00A57ADD /* Main.storyboard */,
15A3B50826EE147B00A57ADD /* ViewController.swift */,
15A3B51E26EE16B900A57ADD /* MainVC.swift */,
15A3B52026EE19D600A57ADD /* Cell */,
);
path = Main;
sourceTree = "<group>";
};
15A3B52026EE19D600A57ADD /* Cell */ = {
isa = PBXGroup;
children = (
15A3B52126EE19F000A57ADD /* MainNameTVC.swift */,
);
path = Cell;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -164,8 +175,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
15A3B50926EE147B00A57ADD /* ViewController.swift in Sources */,
15A3B50526EE147B00A57ADD /* AppDelegate.swift in Sources */,
15A3B51F26EE16B900A57ADD /* MainVC.swift in Sources */,
15A3B52226EE19F000A57ADD /* MainNameTVC.swift in Sources */,
15A3B50726EE147B00A57ADD /* SceneDelegate.swift in Sources */,
15A3B50F26EE147B00A57ADD /* AppleContacts.xcdatamodeld in Sources */,
);
Expand Down
93 changes: 89 additions & 4 deletions AppleContacts/AppleContacts/Source/Main/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,32 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<device id="retina6_0" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--MainVC-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="AppleContacts" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="MainVC" id="BYZ-38-t0r" customClass="MainVC" customModule="AppleContacts" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="390" height="844"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mWj-Xv-BAh">
<rect key="frame" x="0.0" y="0.0" width="390" height="130"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="연락처" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ECm-Kc-jrx">
<rect key="frame" x="172.66666666666666" y="50" width="45" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7rd-KI-OPM">
<rect key="frame" x="20" y="45.666666666666664" width="30" height="29.999999999999993"/>
<state key="normal" title="그룹"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WjA-aH-ccx">
<rect key="frame" x="352" y="49.666666666666664" width="18" height="21.999999999999993"/>
<state key="normal" image="plus" catalog="system"/>
</button>
<searchBar contentMode="redraw" searchBarStyle="minimal" translatesAutoresizingMaskIntoConstraints="NO" id="qdg-zg-yT8">
<rect key="frame" x="0.0" y="79" width="390" height="51"/>
<textInputTraits key="textInputTraits"/>
</searchBar>
</subviews>
<color key="backgroundColor" systemColor="systemGray6Color"/>
<constraints>
<constraint firstItem="ECm-Kc-jrx" firstAttribute="top" secondItem="mWj-Xv-BAh" secondAttribute="top" constant="50" id="1e8-NX-Mp9"/>
<constraint firstItem="7rd-KI-OPM" firstAttribute="leading" secondItem="mWj-Xv-BAh" secondAttribute="leading" constant="20" id="2fI-yL-HUm"/>
<constraint firstItem="7rd-KI-OPM" firstAttribute="centerY" secondItem="ECm-Kc-jrx" secondAttribute="centerY" id="44q-Ju-lKQ"/>
<constraint firstItem="WjA-aH-ccx" firstAttribute="centerY" secondItem="ECm-Kc-jrx" secondAttribute="centerY" id="8er-7H-PPk"/>
<constraint firstAttribute="trailing" secondItem="qdg-zg-yT8" secondAttribute="trailing" id="8zL-yp-fJU"/>
<constraint firstAttribute="trailing" secondItem="WjA-aH-ccx" secondAttribute="trailing" constant="20" id="Gu7-c3-R1x"/>
<constraint firstItem="ECm-Kc-jrx" firstAttribute="centerX" secondItem="mWj-Xv-BAh" secondAttribute="centerX" id="HwQ-LZ-rIt"/>
<constraint firstAttribute="bottom" secondItem="qdg-zg-yT8" secondAttribute="bottom" id="Pxn-wY-4Yd"/>
<constraint firstAttribute="height" constant="130" id="YZd-ZO-G4y"/>
<constraint firstItem="qdg-zg-yT8" firstAttribute="leading" secondItem="mWj-Xv-BAh" secondAttribute="leading" id="aEn-fT-rbB"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="8di-aH-Q9Z">
<rect key="frame" x="0.0" y="130" width="390" height="714"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="MainNameTVC" id="zbT-Np-7I1" customClass="MainNameTVC" customModule="AppleContacts" customModuleProvider="target">
<rect key="frame" x="0.0" y="24.333333969116211" width="390" height="28.333333969116211"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="zbT-Np-7I1" id="NhM-Ae-UgY">
<rect key="frame" x="0.0" y="0.0" width="390" height="28.333333969116211"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1ce-Ks-6np">
<rect key="frame" x="20.000000000000004" y="5" width="40.333333333333343" height="18.333333333333332"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="1ce-Ks-6np" secondAttribute="bottom" constant="5" id="Nqk-hB-Cqw"/>
<constraint firstItem="1ce-Ks-6np" firstAttribute="top" secondItem="NhM-Ae-UgY" secondAttribute="top" constant="5" id="YjU-ht-D4v"/>
<constraint firstItem="1ce-Ks-6np" firstAttribute="leading" secondItem="NhM-Ae-UgY" secondAttribute="leading" constant="20" id="vOt-8f-xFB"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="nameLabel" destination="1ce-Ks-6np" id="Y2Z-RI-1Te"/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="8di-aH-Q9Z" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="0AJ-Ey-V5l"/>
<constraint firstItem="8di-aH-Q9Z" firstAttribute="top" secondItem="mWj-Xv-BAh" secondAttribute="bottom" id="Uhn-nN-zsR"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="8di-aH-Q9Z" secondAttribute="trailing" id="X4T-fh-1mP"/>
<constraint firstItem="mWj-Xv-BAh" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="fE9-YG-dW4"/>
<constraint firstItem="mWj-Xv-BAh" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="gu8-4O-ysp"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="mWj-Xv-BAh" secondAttribute="trailing" id="inu-YJ-6Gd"/>
<constraint firstAttribute="bottom" secondItem="8di-aH-Q9Z" secondAttribute="bottom" id="wo5-QT-UWu"/>
</constraints>
</view>
<connections>
<outlet property="searchBar" destination="qdg-zg-yT8" id="id5-uZ-bOX"/>
<outlet property="tableview" destination="8di-aH-Q9Z" id="MpO-li-6Ya"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="97" y="94"/>
</scene>
</scenes>
<resources>
<image name="plus" catalog="system" width="128" height="113"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemGray6Color">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
30 changes: 30 additions & 0 deletions AppleContacts/AppleContacts/Source/Main/Cell/MainNameTVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// MainNameTVC.swift
// AppleContacts
//
// Created by 김혜수 on 2021/09/12.
//

import UIKit

class MainNameTVC: UITableViewCell {

public static let identifier = "MainNameTVC"

@IBOutlet weak var nameLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

func setData(name: String){
nameLabel.text = name
}

}
66 changes: 66 additions & 0 deletions AppleContacts/AppleContacts/Source/Main/MainVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// MainVC.swift
// AppleContacts
//
// Created by 김혜수 on 2021/09/12.
//

import UIKit

class MainVC: UIViewController {

let dummy = ["리정", "가비", "로잘린"]

// MARK: - IBOutlet
@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var tableview: UITableView!

// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
setUI()
setTableview()
}

// MARK: - UI
func setUI(){
setSearchBarUI()
}

// MARK: UI / SearchBarUI
func setSearchBarUI(){
searchBar.barTintColor = .systemGray6
searchBar.layer.borderColor = UIColor.systemGray6.cgColor
}

// MARK: - setTableView
func setTableview(){
tableview.delegate = self
tableview.dataSource = self
}

}

extension MainVC: UITableViewDelegate {

}

extension MainVC: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dummy.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: MainNameTVC.identifier, for: indexPath) as? MainNameTVC else {
return UITableViewCell()
}
cell.setData(name: dummy[indexPath.row])
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 40
}


}
19 changes: 0 additions & 19 deletions AppleContacts/AppleContacts/Source/Main/ViewController.swift

This file was deleted.

0 comments on commit f1a2947

Please sign in to comment.