-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [FEAT] 과방탭 질문 메인뷰 디자인 수정사항 대응 #254
Changes from all commits
e0710f8
b2e68c7
82a5f0f
b463f03
ecefab8
a844c89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,20 +16,38 @@ class QuestionMainVC: BaseVC { | |
$0.isScrollEnabled = true | ||
} | ||
private let contentView = UIView() | ||
private let personalQuestionBtn = UIButton().then { | ||
$0.setBackgroundImage(UIImage(named: "imgRoomMain"), for: .normal) | ||
$0.contentMode = .scaleToFill | ||
private let personalQuestionLabel = UILabel().then { | ||
$0.text = "선배에게 1:1 개인 질문" | ||
$0.textColor = .black | ||
$0.font = .PretendardM(size: 16.0) | ||
$0.sizeToFit() | ||
} | ||
|
||
private let whiteBoardView = UIView().then { | ||
$0.backgroundColor = .white | ||
$0.layer.borderWidth = 1 | ||
$0.layer.borderColor = UIColor.gray0.cgColor | ||
$0.makeRounded(cornerRadius: 16) | ||
} | ||
|
||
private let questionBoardImgView = UIImageView().then { | ||
$0.image = UIImage(named: "imgRoomMain") | ||
} | ||
|
||
private let findSunbaeImgView = UIImageView().then { | ||
$0.image = UIImage(named: "findSunbae") | ||
} | ||
|
||
private let findSunbaeEntireBtn = UIButton() | ||
private let entireQuestionTitleLabel = UILabel().then { | ||
$0.text = "전체에게 질문" | ||
$0.text = "선배 전체에게 질문" | ||
$0.textColor = .black | ||
$0.font = .PretendardM(size: 16.0) | ||
$0.sizeToFit() | ||
} | ||
|
||
private let entireQuestionTV = UITableView().then { | ||
$0.layer.cornerRadius = 8 | ||
$0.layer.cornerRadius = 16 | ||
$0.layer.borderWidth = 1 | ||
$0.layer.borderColor = UIColor.gray0.cgColor | ||
$0.isScrollEnabled = false | ||
|
@@ -49,13 +67,13 @@ class QuestionMainVC: BaseVC { | |
setUpDelegate() | ||
setUpTapInfoBtn() | ||
registerCell() | ||
setUpTapPersonalQuestionBtn() | ||
setUpTapFindSunbaeBtn() | ||
addActivateIndicator() | ||
setUpRequestData() | ||
NotificationCenter.default.addObserver(self, selector: #selector(updateDataBySelectedMajor), name: Notification.Name.dismissHalfModal, object: nil) | ||
} | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
override func viewDidAppear(_ animated: Bool) { | ||
setUpRequestData() | ||
} | ||
} | ||
|
@@ -65,10 +83,10 @@ extension QuestionMainVC { | |
|
||
/// 전체 UI를 구성하는 메서드 | ||
private func configureUI() { | ||
|
||
view.addSubview(questionSV) | ||
questionSV.addSubview(contentView) | ||
contentView.addSubviews([questionSegmentView, personalQuestionBtn, entireQuestionTitleLabel, entireQuestionTV]) | ||
contentView.addSubviews([questionSegmentView, personalQuestionLabel, whiteBoardView, questionBoardImgView, findSunbaeImgView, findSunbaeEntireBtn, entireQuestionTitleLabel, entireQuestionTV]) | ||
|
||
questionSV.snp.makeConstraints { | ||
$0.top.leading.trailing.bottom.equalToSuperview() | ||
|
@@ -86,24 +104,48 @@ extension QuestionMainVC { | |
$0.height.equalTo(38.adjustedH) | ||
} | ||
|
||
personalQuestionBtn.snp.makeConstraints { | ||
personalQuestionLabel.snp.makeConstraints { | ||
$0.top.equalTo(questionSegmentView.snp.bottom).offset(16) | ||
$0.leading.equalToSuperview().offset(24) | ||
$0.height.equalTo(19) | ||
} | ||
|
||
whiteBoardView.snp.makeConstraints { | ||
$0.top.equalTo(personalQuestionLabel.snp.bottom).offset(16) | ||
$0.leading.equalToSuperview().offset(24) | ||
$0.trailing.equalToSuperview().offset(-24) | ||
$0.height.equalTo(176.adjustedH) | ||
$0.height.equalTo(188.adjustedH) | ||
$0.width.equalTo(327.adjustedH) | ||
$0.centerX.equalToSuperview() | ||
} | ||
|
||
questionBoardImgView.snp.makeConstraints { | ||
$0.leading.trailing.equalTo(whiteBoardView) | ||
$0.bottom.equalTo(whiteBoardView.snp.bottom) | ||
$0.height.equalTo(144.adjustedH) | ||
$0.centerX.equalToSuperview() | ||
} | ||
|
||
findSunbaeImgView.snp.makeConstraints { | ||
$0.top.equalTo(whiteBoardView.snp.top).offset(4) | ||
$0.trailing.equalTo(whiteBoardView.snp.trailing).offset(-8) | ||
$0.width.equalTo(104.adjusted) | ||
$0.height.equalTo(36.adjustedH) | ||
} | ||
|
||
findSunbaeEntireBtn.snp.makeConstraints { | ||
$0.top.leading.trailing.bottom.equalTo(whiteBoardView) | ||
} | ||
|
||
entireQuestionTitleLabel.snp.makeConstraints { | ||
$0.top.equalTo(personalQuestionBtn.snp.bottom).offset(24) | ||
$0.leading.equalTo(personalQuestionBtn) | ||
$0.top.equalTo(whiteBoardView.snp.bottom).offset(40) | ||
$0.leading.equalTo(whiteBoardView) | ||
$0.height.equalTo(19) | ||
} | ||
|
||
entireQuestionTV.snp.makeConstraints { | ||
$0.top.equalTo(entireQuestionTitleLabel.snp.bottom).offset(16) | ||
$0.leading.trailing.equalTo(personalQuestionBtn) | ||
$0.leading.trailing.equalTo(whiteBoardView) | ||
$0.height.equalTo(236) | ||
$0.bottom.equalToSuperview().offset(-24) | ||
} | ||
|
@@ -149,8 +191,8 @@ extension QuestionMainVC { | |
} | ||
|
||
/// 질문가능선배Btn tap Action 설정 메서드 | ||
private func setUpTapPersonalQuestionBtn() { | ||
personalQuestionBtn.press(vibrate: true) { | ||
private func setUpTapFindSunbaeBtn() { | ||
findSunbaeEntireBtn.press(vibrate: true) { | ||
let questionPersonVC = QuestionPersonListVC() | ||
questionPersonVC.majorID = MajorInfo.shared.selectedMajorID ?? UserDefaults.standard.value(forKey: UserDefaults.Keys.FirstMajorID) as! Int | ||
self.navigationController?.pushViewController(questionPersonVC, animated: true) | ||
|
@@ -173,6 +215,17 @@ extension QuestionMainVC { | |
activityIndicator.center = CGPoint(x: self.view.center.x, y: view.center.y - 106) | ||
view.addSubview(self.activityIndicator) | ||
} | ||
|
||
/// entireQuestionTV 업데이트 메서드 | ||
private func updateEntireQuestionTV() { | ||
DispatchQueue.main.async { | ||
self.entireQuestionTV.reloadData() | ||
self.entireQuestionTV.layoutIfNeeded() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요기 layoutIfNeeded() 이후에 automaticDimension 다시 호출해도 안됏어? ㅠ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 한번 해볼겡!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅠㅠ 안된다 ~~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 호출시점을 바꿔봐도 두번정도 reload를 시켜야 얘가 딱 맞네 뭐 학습되는건가 ㅋㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 일단 머지하겠슴다..~ |
||
self.entireQuestionTV.snp.updateConstraints { | ||
$0.height.equalTo(self.entireQuestionTV.contentSize.height) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// MARK: - UITableViewDataSource | ||
|
@@ -229,9 +282,9 @@ extension QuestionMainVC: UITableViewDelegate { | |
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { | ||
switch indexPath.section { | ||
case 0: | ||
return 70 | ||
return 44 | ||
case 1: | ||
return (questionList.count == 0 ? 236 : 120) | ||
return (questionList.count == 0 ? 189 : 120) | ||
case 2: | ||
return (questionList.count > 5 ? 40 : 0) | ||
default: | ||
|
@@ -243,9 +296,9 @@ extension QuestionMainVC: UITableViewDelegate { | |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
switch indexPath.section { | ||
case 0: | ||
return 70 | ||
return 44 | ||
case 1: | ||
return (questionList.count == 0 ? 236 : UITableView.automaticDimension) | ||
return (questionList.count == 0 ? 189 : UITableView.automaticDimension) | ||
case 2: | ||
return (questionList.count > 5 ? 40 : 0) | ||
default: | ||
|
@@ -283,13 +336,7 @@ extension QuestionMainVC { | |
case .success(let res): | ||
if let data = res as? [ClassroomPostList] { | ||
self.questionList = data | ||
DispatchQueue.main.async { | ||
self.entireQuestionTV.reloadData() | ||
self.entireQuestionTV.layoutIfNeeded() | ||
self.entireQuestionTV.snp.updateConstraints { | ||
$0.height.equalTo(self.entireQuestionTV.contentSize.height) | ||
} | ||
} | ||
self.updateEntireQuestionTV() | ||
self.activityIndicator.stopAnimating() | ||
} | ||
case .requestErr(let msg): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "btn_write.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "btn_write.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "imgRoomMain.png", | ||
"idiom" : "universal", | ||
"filename" : "imgRoomMain.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"filename" : "[email protected]", | ||
"idiom" : "universal" | ||
"idiom" : "universal", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "3x" | ||
"scale" : "3x", | ||
"filename" : "[email protected]" | ||
} | ||
], | ||
"info" : { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요것이 그부분인가보네....