Skip to content

Commit

Permalink
[FEAT][#59] 세션 등록 중 장소등록 GUI 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
dayo2n committed Feb 22, 2023
1 parent 9425576 commit 5817d86
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions momoIOS/AdminSide/AdminSession/RegisterPlaceViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RegisterPlaceViewController: UIViewController {
private let searchGuideLabel: UILabel = {
let label = UILabel()
label.text = "도로명이나 지역명을 이용해서 검색해보세요.\n건물번호, 번지를 입력하시면 정확하게 검색됩니다."
label.font = .systemFont(ofSize: 16, weight: .light)
label.font = .systemFont(ofSize: 16, weight: UIFont.Weight(500))
label.textColor = .rgba(138, 138, 138, 1)
label.numberOfLines = 0
return label
Expand Down Expand Up @@ -50,33 +50,44 @@ class RegisterPlaceViewController: UIViewController {
// MARK: - Helpers

private func setupCustomNav() {
let appearance = UINavigationBarAppearance()
appearance.shadowColor = .rgba(24, 24, 24, 0.16)
appearance.backgroundColor = .white

let navBar = self.navigationController?.navigationBar
navBar?.scrollEdgeAppearance = appearance
navBar?.tintColor = .black

self.navigationItem.hidesBackButton = true
navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "arrow.left"), style: .plain, target: self, action: #selector(goBackToAddSessionVC))

let title = UILabel()
title.text = "장소등록"
title.font = .systemFont(ofSize: 16, weight: .semibold)
title.font = .systemFont(ofSize: 16)
self.navigationItem.titleView = title
}

private func setupSearchArea() {
searchBar.delegate = self
searchBar.placeholder = "검색"
searchBar.setImage(UIImage(), for: .search, state: .normal)
searchBar.searchTextField.backgroundColor = .clear

/// searchBar의 배경색 지정
searchBar.backgroundColor = .rgba(248, 248, 249, 1)

/// default border를 없애고 searchBar 내 textField 배경색 지정
searchBar.searchTextField.borderStyle = .none
searchBar.searchTextField.backgroundColor = .rgba(248, 248, 249, 1)
searchBar.searchBarStyle = .minimal

/// placeholder와 text 속성 설정
searchBar.searchTextField.font = .systemFont(ofSize: 14, weight: .medium)
searchBar.searchTextField.textColor = .black
searchBar.searchTextField.attributedPlaceholder = NSAttributedString(
string: "검색",
attributes: [NSAttributedString.Key.foregroundColor: UIColor.rgba(179, 182, 197, 1),
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14, weight: UIFont.Weight(500))])
// TODO: - placeholder의 foregroundColor는 GUI의 gray500, 추후 extension에 추가되면 수정

/// 이외 속성들 설정
searchBar.setImage(UIImage(), for: .search, state: .normal)
searchBar.searchTextField.clearButtonMode = .never
searchBar.layer.borderWidth = 1
searchBar.layer.cornerRadius = 8
searchBar.layer.borderColor = UIColor.rgba(230, 230, 230, 1).cgColor
searchBar.layer.borderColor = UIColor.clear.cgColor

view.addSubviews(searchBar, searchIcon)
searchIcon.image = searchIcon.image?.withRenderingMode(.alwaysTemplate)
Expand Down Expand Up @@ -162,7 +173,7 @@ extension RegisterPlaceViewController: GMSAutocompleteTableDataSourceDelegate {
}
}
self.searchBar.endEditing(true)
self.searchBar.text = ""
self.searchBar.text = "" /// Notes: 장소를 선택한 후 UISearchBar의 text를 비워주지 않으면 placeholder가 검색어로 바뀜.
}

func tableDataSource(_ tableDataSource: GMSAutocompleteTableDataSource, didFailAutocompleteWithError error: Error) {
Expand Down

0 comments on commit 5817d86

Please sign in to comment.