diff --git a/29th-assignment-YouTube/Resources/Storyboards/Base.lproj/Main.storyboard b/29th-assignment-YouTube/Resources/Storyboards/Base.lproj/Main.storyboard index f651e71..8d0bc77 100644 --- a/29th-assignment-YouTube/Resources/Storyboards/Base.lproj/Main.storyboard +++ b/29th-assignment-YouTube/Resources/Storyboards/Base.lproj/Main.storyboard @@ -339,6 +339,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -611,12 +692,14 @@ + + diff --git a/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.swift b/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.swift index 2f939bd..4ac90fd 100644 --- a/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.swift +++ b/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.swift @@ -30,4 +30,8 @@ class HomeTableViewCell: UITableViewCell { // Configure the view for the selected state } + + + + } diff --git a/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.xib b/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.xib index d98dd9a..90b978b 100644 --- a/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.xib +++ b/29th-assignment-YouTube/Sources/HomeVC/HomeTableViewCell.xib @@ -17,7 +17,7 @@ - + diff --git a/29th-assignment-YouTube/Sources/HomeVC/HomeTapVC.swift b/29th-assignment-YouTube/Sources/HomeVC/HomeTapVC.swift new file mode 100644 index 0000000..85535c6 --- /dev/null +++ b/29th-assignment-YouTube/Sources/HomeVC/HomeTapVC.swift @@ -0,0 +1,25 @@ +// +// HomeTapVC.swift +// 29th-assignmnet-YouTube +// +// Created by 박예빈 on 2021/12/10. +// + +import UIKit + +class HomeTapVC: UIViewController { + static let identifier = "HomeTapVC" + + @IBOutlet weak var subtitleLabel: UILabel! + @IBOutlet weak var titleLabel: UILabel! + @IBOutlet weak var imgView: UIImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + @IBAction func touchUpToBack(_ sender: Any) { + self.dismiss(animated: true, completion: nil) + } +} diff --git a/29th-assignment-YouTube/Sources/HomeVC/HomeVC.swift b/29th-assignment-YouTube/Sources/HomeVC/HomeVC.swift index 52a183c..180e056 100644 --- a/29th-assignment-YouTube/Sources/HomeVC/HomeVC.swift +++ b/29th-assignment-YouTube/Sources/HomeVC/HomeVC.swift @@ -7,7 +7,7 @@ import UIKit -class HomeVC: UIViewController { +class HomeVC: UIViewController, UIGestureRecognizerDelegate { @IBOutlet weak var storyCollectionView: UICollectionView! @IBOutlet weak var filterCollectionView: UICollectionView! @@ -20,14 +20,7 @@ class HomeVC: UIViewController { initContentList() registerXib() - storyCollectionView.dataSource = self - filterCollectionView.dataSource = self - storyCollectionView.delegate = self - filterCollectionView.delegate = self - mainTableView.delegate = self - mainTableView.dataSource = self - - + setDataSourceWithDelegate() } @IBAction func touchUpToGoLogin(_ sender: Any) { @@ -37,6 +30,15 @@ class HomeVC: UIViewController { } + func setDataSourceWithDelegate() { + storyCollectionView.dataSource = self + filterCollectionView.dataSource = self + storyCollectionView.delegate = self + filterCollectionView.delegate = self + mainTableView.delegate = self + mainTableView.dataSource = self + } + func registerXib(){ let xibName = UINib(nibName: HomeTableViewCell.identifier, bundle: nil) mainTableView.register(xibName, forCellReuseIdentifier: HomeTableViewCell.identifier) @@ -58,7 +60,6 @@ class HomeVC: UIViewController { extension HomeVC: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 306 - } } @@ -71,8 +72,26 @@ extension HomeVC: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: HomeTableViewCell.identifier) as? HomeTableViewCell else {return UITableViewCell()} + let tapRecorgnizer = UITapGestureRecognizer(target: self, action: #selector(tapView(gestureRecognizer:))) + cell.mainImageView.addGestureRecognizer(tapRecorgnizer) + tapRecorgnizer.delegate = self + return cell } + + @objc func tapView(gestureRecognizer: UIGestureRecognizer) { + guard let nextVC = self.storyboard?.instantiateViewController(withIdentifier: HomeTapVC.identifier) as? HomeTapVC else { return } + + nextVC.modalPresentationStyle = .fullScreen + + present(nextVC, animated: true) { + nextVC.imgView.image = UIImage(named: "soptIOS") + nextVC.titleLabel.text = "1차 세미나 : iOS 컴포넌트 이해, XCode 기본 사용법, View 화면 전환" + nextVC.subtitleLabel.text = "WE SOPT ・조회수 100만회 ・ 3주 전" + + } + } + } // MARK: CollectionView @@ -83,7 +102,6 @@ extension HomeVC: UICollectionViewDataSource { } else { return 6 } - } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { @@ -107,7 +125,7 @@ extension HomeVC: UICollectionViewDelegateFlowLayout { if collectionView == storyCollectionView { return CGSize(width: 72, height: 104) } else { - print(UIImage(named: "filter-" + String(indexPath.row + 1))?.size.width) +// print(UIImage(named: "filter-" + String(indexPath.row + 1))?.size.width) return CGSize(width:((UIImage(named: "filter-" + String(indexPath.row + 1)))?.size.width)!, height: 32) } diff --git a/29th-assignment-YouTube/Sources/SignInViewController/SignInViewController.swift b/29th-assignment-YouTube/Sources/SignInViewController/SignInViewController.swift index 2806343..71df73f 100644 --- a/29th-assignment-YouTube/Sources/SignInViewController/SignInViewController.swift +++ b/29th-assignment-YouTube/Sources/SignInViewController/SignInViewController.swift @@ -25,8 +25,6 @@ class SignInViewController: UIViewController, UITextFieldDelegate { super.viewDidLoad() setUI() - - } // MARK: - Custom Method diff --git a/29th-assignmnet-YouTube.xcodeproj/project.pbxproj b/29th-assignmnet-YouTube.xcodeproj/project.pbxproj index eefcbe0..f053887 100644 --- a/29th-assignmnet-YouTube.xcodeproj/project.pbxproj +++ b/29th-assignmnet-YouTube.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1501BB9D276382430084AAE4 /* HomeTapVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1501BB9C276382430084AAE4 /* HomeTapVC.swift */; }; 15B2AE83272AF8ED00FFC5B2 /* UINavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15B2AE82272AF8ED00FFC5B2 /* UINavigationController.swift */; }; 15B2AE85272AFA2900FFC5B2 /* UITextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15B2AE84272AFA2900FFC5B2 /* UITextField.swift */; }; 15B2AE87272AFDD800FFC5B2 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15B2AE86272AFDD800FFC5B2 /* UIColor.swift */; }; @@ -39,6 +40,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1501BB9C276382430084AAE4 /* HomeTapVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeTapVC.swift; sourceTree = ""; }; 15B2AE82272AF8ED00FFC5B2 /* UINavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UINavigationController.swift; sourceTree = ""; }; 15B2AE84272AFA2900FFC5B2 /* UITextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITextField.swift; sourceTree = ""; }; 15B2AE86272AFDD800FFC5B2 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; @@ -248,6 +250,7 @@ 15B2AE92272B24D700FFC5B2 /* HomeTableViewCell.swift */, 15B2AE93272B24D700FFC5B2 /* HomeTableViewCell.xib */, 15FF7ED8272B35E7004BE9D1 /* FilterCollectionViewCell.swift */, + 1501BB9C276382430084AAE4 /* HomeTapVC.swift */, ); path = HomeVC; sourceTree = ""; @@ -412,6 +415,7 @@ 15B2AE89272B139300FFC5B2 /* StoryCollectionViewCell.swift in Sources */, 15B2AE8B272B17BB00FFC5B2 /* StoryDataModel.swift in Sources */, 15F3BA35271DCD7D00D51D4E /* HomeVC.swift in Sources */, + 1501BB9D276382430084AAE4 /* HomeTapVC.swift in Sources */, 15B2AE83272AF8ED00FFC5B2 /* UINavigationController.swift in Sources */, 15F3BA37271DCDD500D51D4E /* ShortsVC.swift in Sources */, 15B2AE94272B24D700FFC5B2 /* HomeTableViewCell.swift in Sources */, diff --git a/29th-assignmnet-YouTube.xcworkspace/xcuserdata/beans_bin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/29th-assignmnet-YouTube.xcworkspace/xcuserdata/beans_bin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..856110c --- /dev/null +++ b/29th-assignmnet-YouTube.xcworkspace/xcuserdata/beans_bin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + +