Skip to content

Commit 319a051

Browse files
committed
[FEAT] #18 데이터 연결 & 세팅 탭 세부조정
1 parent 45a8bc2 commit 319a051

4 files changed

Lines changed: 17 additions & 12 deletions

File tree

Pinit/Pinit/Views/PinDetail/PinDetailHeader.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class PinDetailHeader: UIView {
6464
public lazy var pinImageView: UIImageView = {
6565
let imageView = UIImageView()
6666
imageView.image = UIImage(named: "sampleImg.jpg")
67+
imageView.contentMode = .scaleAspectFit
6768
return imageView
6869
}()
6970

Pinit/Pinit/Views/PinDetail/PinDetailViewController.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ final class PinDetailViewController: UIViewController {
2020
init(_ entity: PinEntity) {
2121
self.pinEntity = entity
2222

23-
if entity.address == "" {
24-
self.reviewPanelContainer.isHidden = true
25-
self.pinTableView.isHidden = true
26-
}
2723
super.init(nibName: nil, bundle: nil)
2824
}
2925

@@ -66,8 +62,8 @@ final class PinDetailViewController: UIViewController {
6662

6763
let annotation = MKPointAnnotation()
6864
annotation.coordinate = CLLocationCoordinate2D(latitude: lat, longitude: long) // San Francisco, CA
69-
annotation.title = "San Francisco"
70-
annotation.subtitle = "CA"
65+
annotation.title = pinEntity.title
66+
annotation.subtitle = pinEntity.weather
7167
map.addAnnotation(annotation)
7268

7369
return map
@@ -219,6 +215,7 @@ extension PinDetailViewController: UITableViewDataSource, UITableViewDelegate {
219215
let header = PinDetailHeader()
220216
header.pinDate.text = pinEntity.date.koreanDateString()
221217
header.pinTitle.text = pinEntity.title
218+
header.pinImageView.image = pinEntity.mediaPath
222219
header.pinWeather.text = pinEntity.weather
223220
header.pinDescription.text = pinEntity.description
224221
header.pinMenuButton.addTarget(self, action: #selector(pinMenuButtonTapped), for: .touchUpInside)

Pinit/Pinit/Views/Setting/ProducerCollectionViewCell.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ProducerCollectionViewCell : UICollectionViewCell {
2020

2121
public lazy var thumbnailImageView: UIImageView = {
2222
let imageView = UIImageView()
23-
imageView.contentMode = .scaleAspectFill
23+
imageView.contentMode = .scaleToFill
2424
imageView.backgroundColor = .lightGray
2525
return imageView
2626
}()
@@ -87,3 +87,7 @@ class ProducerCollectionViewCell : UICollectionViewCell {
8787
}
8888
}
8989
}
90+
91+
#Preview {
92+
SettingViewController()
93+
}

Pinit/Pinit/Views/Setting/SettingViewController.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ final class SettingViewController: UIViewController {
3030

3131
override func viewDidLoad() {
3232
super.viewDidLoad()
33-
view.backgroundColor = .white
33+
navigationController?.setNavigationBarHidden(true, animated: true)
34+
extendedLayoutIncludesOpaqueBars = true
35+
view.backgroundColor = .secondarySystemBackground
3436

3537
view.addSubview(produceCollectionView)
3638
view.addSubview(resetButton)
3739

3840
produceCollectionView.delegate = self
3941
produceCollectionView.dataSource = self
42+
produceCollectionView.backgroundColor = .secondarySystemBackground
4043

4144
//버튼 레이아웃 설정
4245
resetButton.setTitle("전체 기록 삭제", for: .normal)
@@ -78,7 +81,7 @@ final class SettingViewController: UIViewController {
7881
extension SettingViewController : UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
7982

8083
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
81-
let detailVC = PinDetailViewController() //프로필 누르면 상세 화면으로
84+
let detailVC = PinDetailViewController(PinEntity.producerData[indexPath.row]) //프로필 누르면 상세 화면으로
8285

8386
present(detailVC, animated: true ,completion: nil )
8487
}
@@ -104,16 +107,16 @@ extension SettingViewController : UICollectionViewDelegate, UICollectionViewDele
104107
extension SettingViewController {
105108
private func autoLayout() {
106109
resetButton.snp.makeConstraints {
107-
$0.bottom.equalTo(view.safeAreaLayoutGuide)
108-
$0.height.equalTo(70)
110+
$0.bottom.equalTo(view.safeAreaLayoutGuide).inset(10)
111+
$0.height.equalTo(60)
109112
$0.leading.equalToSuperview().inset(10)
110113
$0.trailing.equalToSuperview().offset(-10)
111114
}
112115
//컬렉션 뷰 제약 설정 부분 예정
113116
produceCollectionView.snp.makeConstraints {
114117
$0.top.equalTo(view.safeAreaLayoutGuide).inset(10)
115118
$0.width.equalToSuperview()
116-
$0.bottom.equalTo(resetButton.snp.top)
119+
$0.bottom.equalTo(resetButton.snp.top).offset(-10)
117120
}
118121
}
119122
}

0 commit comments

Comments
 (0)