Skip to content

Commit

Permalink
Merge pull request TeamNADA#98 from mini-min/feature/TeamNADA#91
Browse files Browse the repository at this point in the history
[FEAT] TeamNADA#91 - 다크, 라이트 모드는 일단 시스템 따라가기로
  • Loading branch information
mini-min authored Nov 30, 2021
2 parents 2694fcb + a590771 commit fafb43f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 51 deletions.
15 changes: 15 additions & 0 deletions NADA-iOS-forRelease/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIAppFonts</key>
<array>
<string>NotoSansCJKkr-Bold.otf</string>
<string>NotoSansCJKkr-Medium.otf</string>
<string>NotoSansCJKkr-Regular.otf</string>
<string>Spoqa Han Sans Neo Bold.otf</string>
<string>Spoqa Han Sans Neo Regular.otf</string>
</array>
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Foundation
import UIKit

extension UIViewController {

/// 취소+삭제 UIAlertController
func makeCancelDeleteAlert(title: String,
message: String,
Expand Down
6 changes: 3 additions & 3 deletions NADA-iOS-forRelease/Resouces/Storyboards/More/More.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
</constraints>
</view>
<tableView autoresizesSubviews="NO" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" scrollEnabled="NO" bouncesZoom="NO" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" estimatedSectionHeaderHeight="-1" sectionFooterHeight="28" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="WnB-Ge-3qg">
<rect key="frame" x="0.0" y="104" width="375" height="466"/>
<rect key="frame" x="0.0" y="104" width="375" height="404"/>
<color key="backgroundColor" name="textBox"/>
<constraints>
<constraint firstAttribute="height" constant="466" id="F5a-T6-amW"/>
<constraint firstAttribute="height" constant="404" id="F5a-T6-amW"/>
</constraints>
</tableView>
</subviews>
Expand All @@ -67,7 +67,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="64" y="56"/>
<point key="canvasLocation" x="63.200000000000003" y="55.418719211822662"/>
</scene>
</scenes>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,12 @@ import UIKit

class MoreListTableViewCell: UITableViewCell {

let myUserDefaults = UserDefaults.standard

@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var modeSwitch: UISwitch!
@IBOutlet weak var separatorView: UIView!

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
setModeBySwitch()
}

@IBAction func modeChangeButton(_ sender: Any) {
myUserDefaults.set(modeSwitch.isOn, forKey: "switchState")

if #available(iOS 13, *) {
window!.overrideUserInterfaceStyle = modeSwitch.isOn == true ? .dark : .light
} else {
window?.overrideUserInterfaceStyle = .light
}
}

static func nib() -> UINib {
Expand All @@ -39,8 +25,4 @@ class MoreListTableViewCell: UITableViewCell {
super.setSelected(selected, animated: animated)

}

func setModeBySwitch() {
modeSwitch.isOn = myUserDefaults.bool(forKey: "switchState")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,19 @@
<constraint firstAttribute="height" constant="1" id="JaL-30-a4H"/>
</constraints>
</view>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="X9p-6n-YCp">
<rect key="frame" x="302" y="13" width="51" height="32"/>
<connections>
<action selector="modeChangeButton:" destination="KGk-i7-Jjw" eventType="valueChanged" id="76S-PD-4BQ"/>
</connections>
</switch>
</subviews>
<color key="backgroundColor" name="background"/>
<constraints>
<constraint firstItem="ZEb-kz-9Ea" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="8GW-mI-P4b"/>
<constraint firstItem="ZEb-kz-9Ea" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="32" id="94J-lZ-0o9"/>
<constraint firstItem="QoL-PR-cfm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="ESt-jC-Lig"/>
<constraint firstAttribute="trailing" secondItem="X9p-6n-YCp" secondAttribute="trailing" constant="24" id="Szs-hm-KCD"/>
<constraint firstItem="X9p-6n-YCp" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="ZU2-nv-rwV"/>
<constraint firstAttribute="trailing" secondItem="QoL-PR-cfm" secondAttribute="trailing" constant="16" id="bKa-vh-6I3"/>
<constraint firstItem="X9p-6n-YCp" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="13" id="glA-bt-HG0"/>
<constraint firstAttribute="bottom" secondItem="QoL-PR-cfm" secondAttribute="bottom" id="sOk-Ny-hpT"/>
<constraint firstItem="ZEb-kz-9Ea" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="tsK-gs-8AR"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="modeSwitch" destination="X9p-6n-YCp" id="hL4-79-N7S"/>
<outlet property="separatorView" destination="QoL-PR-cfm" id="B7m-Td-SQ0"/>
<outlet property="titleLabel" destination="ZEb-kz-9Ea" id="cQm-Mv-7vw"/>
</connections>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FrontViewController: UIViewController {

setFrontList()
setBackList()

// TODO: - 서버 테스트
// cardListFetchWithAPI(userID: "nada", isList: false, offset: 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,48 @@ import UIKit

class MoreViewController: UIViewController {

var firstItems = ["다크 모드"]
var secondItems = ["개인정보 처리방침", "서비스 이용약관", "Team NADA", "오픈소스 라이브러리"]
var thirdItems = ["로그아웃", "정보 초기화", "회원탈퇴"]
let defaults = UserDefaults.standard

var firstItems = ["개인정보 처리방침", "서비스 이용약관", "Team NADA", "오픈소스 라이브러리"]
var secondItems = ["로그아웃", "정보 초기화", "회원탈퇴"]

@IBOutlet weak var moreListTableView: UITableView!
// @IBOutlet weak var darkModeHeaderView: UIView!
// @IBOutlet weak var modeSwitch: UISwitch!

override func viewDidLoad() {
super.viewDidLoad()

moreListTableView.register(MoreListTableViewCell.nib(), forCellReuseIdentifier: "MoreListTableViewCell")

moreListTableView.delegate = self
moreListTableView.dataSource = self
// moreListTableView.tableHeaderView = darkModeHeaderView

// TODO: - 다크 모드 대응용 서버 코드
// modeSwitch.isOn = defaults.bool(forKey: "darkModeState")

// if let window = UIApplication.shared.windows.first {
// if #available(iOS 13.0, *) {
// window.overrideUserInterfaceStyle = modeSwitch.isOn == true ? .dark : .light
// defaults.set(modeSwitch.isOn, forKey: "darkModeState")
// } else {
// window.overrideUserInterfaceStyle = .light
// }
// }
}

// @IBAction func darkModeChangeSwitch(_ sender: UISwitch) {
// // TODO: - 다크 모드 대응용 서버 코드
// if let window = UIApplication.shared.windows.first {
// if #available(iOS 13.0, *) {
// window.overrideUserInterfaceStyle = modeSwitch.isOn == true ? .dark : .light
// defaults.set(modeSwitch.isOn, forKey: "darkModeState")
// } else {
// window.overrideUserInterfaceStyle = .light
// }
// }
// }
}

// MARK: - TableView Delegate
Expand All @@ -39,18 +67,17 @@ extension MoreViewController: UITableViewDataSource {
return firstItems.count
} else if section == 1 {
return secondItems.count
} else if section == 2 {
return thirdItems.count
} else {
return 0
}
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 2 {
if section == 0 {
return 5
} else {
return 0
}
return 5
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
Expand All @@ -63,14 +90,8 @@ extension MoreViewController: UITableViewDataSource {
}
} else if indexPath.section == 1 {
serviceCell.titleLabel.text = secondItems[indexPath.row]
serviceCell.modeSwitch.isHidden = true
if indexPath.row == secondItems.count - 1 {
serviceCell.separatorView.isHidden = true
}
} else if indexPath.section == 2 {
serviceCell.titleLabel.text = thirdItems[indexPath.row]
serviceCell.modeSwitch.isHidden = true
}

return serviceCell
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,30 @@
import UIKit

class TabBarViewController: UITabBarController {

let appearance = UITabBarAppearance()

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.

setupStyle()
}

func setupStyle() {
// appearance.configureWithOpaqueBackground()
// appearance.shadowColor = UIColor.clear
// tabBar.standardAppearance = appearance
//
// if #available(iOS 15.0, *) {
// // set tabbar opacity
// tabBar.scrollEdgeAppearance = tabBar.standardAppearance
// }
//
// // set tabbar shadow
// tabBar.layer.masksToBounds = false
// tabBar.layer.shadowColor = UIColor.textBox.cgColor
// tabBar.layer.shadowOpacity = 0.3
// tabBar.layer.shadowOffset = CGSize(width: 0, height: 0)
// tabBar.layer.shadowRadius = 6
}

}

0 comments on commit fafb43f

Please sign in to comment.