-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1] ~7/29 작업상황: 게시글 tableview, location filter button tap action
- Loading branch information
1 parent
9422299
commit db98868
Showing
12 changed files
with
972 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "MOGAK_icon.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
MOGAK/Assets.xcassets/MOGAK_button.imageset/MOGAK_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
MOGAK/Assets.xcassets/MOGAK_button_filled.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "MOGAK_button_filled.svg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
MOGAK/Assets.xcassets/MOGAK_button_filled.imageset/MOGAK_button_filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions
44
MOGAK/Scene/Networking/CategoryFilterCollectionViewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// CategoryFilterCollectionViewCell.swift | ||
// MOGAK | ||
// | ||
// Created by 이재혁 on 2023/07/29. | ||
// | ||
|
||
import UIKit | ||
|
||
class CategoryFilterCollectionViewCell: UICollectionViewCell { | ||
|
||
let categoryButton: UIButton = { | ||
let button = UIButton() | ||
// 버튼의 스타일과 다른 설정들을 지정합니다. | ||
// ... | ||
return button | ||
}() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
//setupButtonConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
//setupButtonConstraints() | ||
} | ||
|
||
private lazy var locationFilterButton: UIButton = { | ||
let button = UIButton() | ||
button.titleLabel?.font = UIFont.pretendard(.semiBold, size: 14) | ||
button.setTitle("", for: .normal) | ||
button.setTitleColor(UIColor(hex: "24252E"), for: .normal) | ||
//button.tintColor = UIColor(hex: "F1F3FA") | ||
button.backgroundColor = UIColor(hex: "F1F3FA") | ||
button.layer.cornerRadius = 20 | ||
button.contentEdgeInsets = UIEdgeInsets(top: 8, left: 20, bottom: 8, right: 20) | ||
|
||
//button.addTarget(self, action: #selector(showLocationFilterSheetView(_:)), for: .touchUpInside) | ||
|
||
return button | ||
}() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// Locations.swift | ||
// MOGAK | ||
// | ||
// Created by 이재혁 on 2023/07/28. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Locations { | ||
var location: String | ||
} | ||
|
||
struct Categories { | ||
var category: String | ||
} | ||
|
||
extension Locations { | ||
static var data = [ | ||
Locations(location: "서울특별시"), | ||
Locations(location: "경기도"), | ||
Locations(location: "세종특별자치시"), | ||
Locations(location: "대전광역시"), | ||
Locations(location: "광주광역시"), | ||
Locations(location: "대구광역시"), | ||
Locations(location: "부산광역시"), | ||
Locations(location: "울산광역시"), | ||
Locations(location: "경상남도"), | ||
Locations(location: "경상북도"), | ||
Locations(location: "전라남도"), | ||
Locations(location: "전라북도"), | ||
Locations(location: "충청남도"), | ||
Locations(location: "충청북도"), | ||
Locations(location: "강원도"), | ||
Locations(location: "제주도"), | ||
Locations(location: "독도/울릉도") | ||
|
||
] | ||
} | ||
|
||
extension Categories { | ||
static var data = [ | ||
Categories(category: "전체"), | ||
Categories(category: "자격증"), | ||
Categories(category: "대외활동"), | ||
Categories(category: "운동"), | ||
Categories(category: "인사이트"), | ||
Categories(category: "공모전"), | ||
Categories(category: "직무공부"), | ||
Categories(category: "산업분석"), | ||
Categories(category: "강연/강의"), | ||
Categories(category: "어학"), | ||
Categories(category: "프로젝트"), | ||
Categories(category: "스터디"), | ||
Categories(category: "기타"), | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// LocationFilterSheetView.swift | ||
// MOGAK | ||
// | ||
// Created by 이재혁 on 2023/07/28. | ||
// | ||
|
||
import UIKit | ||
import SnapKit | ||
|
||
class LocationFilterSheetView: UIViewController, UITableViewDelegate, UITableViewDataSource { | ||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
dataSource.count | ||
} | ||
|
||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
//let cell = tableView.dequeueReusableCell(withIdentifier: "LocationFilterTableViewCell", for: indexPath) as! LocationFilterTableViewCell | ||
guard let cell = tableView.dequeueReusableCell(withIdentifier: "LocationFilterTableViewCell") as? LocationFilterTableViewCell else {return UITableViewCell()} | ||
|
||
let target = dataSource[indexPath.row] | ||
|
||
cell.locationLabel.text = "\(target.location)" | ||
|
||
return cell | ||
} | ||
|
||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
return 45 | ||
} | ||
|
||
// cell 클릭 시 이벤트(콘솔 출력) | ||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
let target = dataSource[indexPath.row] | ||
print("\(target.location)") | ||
} | ||
|
||
lazy var tableView: UITableView = { | ||
let view = UITableView() | ||
view.register(LocationFilterTableViewCell.self, forCellReuseIdentifier: "LocationFilterTableViewCell") | ||
view.delegate = self | ||
view.dataSource = self | ||
|
||
return view | ||
}() | ||
|
||
var dataSource = Locations.data | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
view.backgroundColor = .systemBackground | ||
|
||
//tableView.register(UINib(nibName: "LocationFilterTableViewCell", bundle: nil), forCellReuseIdentifier: "LocationFilterTableViewCell") | ||
|
||
setupSheet() | ||
|
||
view.addSubview(tableView) | ||
tableView.translatesAutoresizingMaskIntoConstraints = false | ||
tableView.snp.makeConstraints({ | ||
$0.top.equalTo(view.snp.top).offset(80) | ||
$0.leading.trailing.equalTo(view).inset(20) | ||
$0.bottom.equalTo(view.snp.bottom).offset(14) | ||
}) | ||
|
||
|
||
} | ||
|
||
private func setupSheet() { | ||
//isModalInPresentation = true : sheet가 dismiss되지 않음!!! default는 false | ||
|
||
if let sheet = sheetPresentationController { | ||
/// 드래그 멈추면 그 위치에 멈추는 지점: default는 large() | ||
//sheet.detents = [.medium(), .large()] | ||
if #available(iOS 16.0, *) { | ||
sheet.detents = [.custom { context in | ||
return context.maximumDetentValue * 0.8 | ||
} | ||
] | ||
} else { | ||
// Fallback on earlier versions | ||
} | ||
/// 초기화 드래그 위치 | ||
sheet.selectedDetentIdentifier = .medium | ||
/// sheet | ||
//sheet.largestUndimmedDetentIdentifier = .medium -> 이게 배경색 흐려지게 하는거였다.. 왜그런진 모르겠다 | ||
/// | ||
sheet.prefersGrabberVisible = true | ||
/// | ||
sheet.delegate = self | ||
/// | ||
sheet.presentingViewController.navigationController?.setNavigationBarHidden(true, animated: false) | ||
|
||
} | ||
} | ||
} | ||
|
Oops, something went wrong.