Skip to content
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 [#50] 투명도 퍼센트에 따른 UI 변경 완료 #53

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>kakaolink</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,19 @@ final class MyPageViewController: UIViewController {

extension MyPageViewController {
private func setUI() {
self.view.backgroundColor = .donBlack
self.tabBarController?.tabBar.isTranslucent = true
self.title = StringLiterals.MyPage.MyPageNavigationTitle
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.donWhite]
self.navigationController?.navigationBar.tintColor = .donBlack
self.navigationController?.navigationBar.barTintColor = .donBlack
self.navigationController?.navigationBar.backgroundColor = .donBlack
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.isTranslucent = true

let statusBarView = UIView(frame: UIApplication.shared.statusBarFrame)
statusBarView.backgroundColor = UIColor.donBlack // 적절한 색상으로 변경 가능
view.addSubview(statusBarView)

let image = ImageLiterals.MyPage.icnMenu
let renderedImage = image.withRenderingMode(.alwaysOriginal)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치는 MyPageViewController 클래스의 setUI() 메서드에 대한 수정입니다.

개선 제안:

  1. 뷰의 배경색을 설정하는 줄이 추가되었습니다. donBlack 색상을 사용하고 있는데, 이 색상은 코드에서 어디에 정의되어 있는지 확인해야 합니다.
  2. 탭 바의 투명성 설정과 네비게이션 바의 속성들이 변경되었습니다. 이러한 변경은 UI 스타일에 따라 다른 의도를 가질 수 있으므로, 주의가 필요합니다. 기존 스타일과 일치하는지 확인해야 합니다.
  3. 상태 바의 배경색을 설정하는 부분이 추가되었습니다. 마찬가지로 donBlack 색상을 사용하고 있는데, 적절한 색상으로 변경할 수 있습니다.

버그 위험:
장기적인 버그 위험이나 잠재적인 오류는 보이지 않습니다. 그러나 donBlack 색상이 어떻게 정의되어 있는지, 적합한지 확인해야 합니다.

전반적으로 코드 작성자의 의도와 스타일 가이드를 고려해 적절한 수정이 필요할 수 있습니다.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ final class MyPageProfileView: UIView {

// MARK: - Properties

let transparencyValue: Int = -85

// MARK: - UI Components

private let profileImageView: UIImageView = {
Expand All @@ -39,7 +41,7 @@ final class MyPageProfileView: UIView {

let userIntroduction: UILabel = {
let label = UILabel()
label.setTextWithLineHeight(text: "안녕하세요반가와요우히히안녕하세요반가와요우히히안녕하세요반가와요우히히안녕하세요반가와요우히히히히", lineHeight: 20.adjusted)
label.setTextWithLineHeight(text: "안녕하세요반가와요우히히안녕하세요반가와요우히히안녕하세요반가와요우히히안녕하세요반가와요우히히히히", lineHeight: 20.adjusted, alignment: .center)
label.textColor = .donGray7
label.textAlignment = .center
label.font = .font(.caption2)
Expand All @@ -65,14 +67,20 @@ final class MyPageProfileView: UIView {
private let emptyTransparencyPercentage: UIImageView = {
let imageView = UIImageView()
imageView.image = ImageLiterals.MyPage.emptyPercentage
imageView.contentMode = .scaleAspectFit
imageView.contentMode = .left
imageView.clipsToBounds = true
imageView.layer.cornerRadius = 5.adjusted
imageView.layer.masksToBounds = true
Comment on lines +70 to +73
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ하..ㅜㅜ수고하셨습니다

return imageView
}()

private let fullTransparencyPercentage: UIImageView = {
let imageView = UIImageView()
imageView.image = ImageLiterals.MyPage.fullPercentage
imageView.contentMode = .scaleAspectFit
imageView.contentMode = .left
imageView.clipsToBounds = true
imageView.layer.cornerRadius = 5.adjusted
imageView.layer.masksToBounds = true
return imageView
}()

Expand Down Expand Up @@ -100,8 +108,6 @@ final class MyPageProfileView: UIView {
setUI()
setHierarchy()
setLayout()
setAddTarget()
setRegisterCell()
}

@available(*, unavailable)
Expand All @@ -115,6 +121,7 @@ final class MyPageProfileView: UIView {
extension MyPageProfileView {
private func setUI() {
self.backgroundColor = .donBlack
self.transparencyLabel.text = "\(self.transparencyValue)%"
}

private func setHierarchy() {
Expand Down Expand Up @@ -157,7 +164,7 @@ extension MyPageProfileView {
}

percentageBox.snp.makeConstraints {
$0.trailing.equalToSuperview().inset(16.adjusted)
$0.trailing.equalToSuperview().offset(((CGFloat(self.transparencyValue) * (UIScreen.main.bounds.width - 32.adjusted)) / 100) - 16.adjusted)
$0.bottom.equalTo(fullTransparencyPercentage.snp.top).offset(-4.adjusted)
$0.height.equalTo(28.adjusted)
}
Expand All @@ -174,26 +181,15 @@ extension MyPageProfileView {
}

fullTransparencyPercentage.snp.makeConstraints {
$0.top.equalTo(userIntroduction.snp.bottom).offset(48.adjusted)
$0.leading.trailing.equalToSuperview().inset(16.adjusted)
$0.height.equalTo(10.adjusted)
$0.top.equalTo(emptyTransparencyPercentage)
$0.leading.equalToSuperview().inset(16.adjusted)
$0.trailing.equalTo(percentageBox.snp.trailing)
$0.height.equalTo(emptyTransparencyPercentage)
}

transparencyInfoButton.snp.makeConstraints {
$0.top.equalTo(fullTransparencyPercentage.snp.bottom).offset(6.adjusted)
$0.leading.equalTo(fullTransparencyPercentage.snp.leading).offset(-10.adjusted)
}
}

private func setAddTarget() {

}

private func setRegisterCell() {

}

private func setDataBind() {

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래는 코드 패치에 대한 간단한 코드 리뷰입니다. 버그 위험 및 개선 제안 사항을 환영합니다:

  • transparencyValuelet 상수로 선언하고 기본값 -85로 설정했습니다.
  • userIntroduction 라벨에 label.setTextWithLineHeight 메서드를 사용하여 텍스트를 설정하고, 정렬 옵션 .center를 추가했습니다.
  • emptyTransparencyPercentagefullTransparencyPercentage 이미지 뷰의 contentMode.left로 변경했습니다.
  • emptyTransparencyPercentagefullTransparencyPercentage 이미지 뷰에 clipsToBounds, layer.cornerRadius, layer.masksToBounds 속성을 추가하여 모서리를 둥글게 처리했습니다.
  • setAddTargetsetRegisterCell 메서드는 비어 있으므로 삭제할 수 있습니다.
  • setUI 메서드에서 backgroundColor.donBlack으로 설정했습니다.
  • transparencyLabel.textself.transparencyValue 값을 텍스트로 설정했습니다.

기타 코드 리뷰는 주어진 코드 스니펫에서 파악하기 어렵습니다. 전체 클래스와 관련된 다른 부분도 고려되어야 합니다.