비플페이 가맹점 찾기 상세 UI 변경
before
after
이 가맹점 찾기 셀 UI를 바꾸는 업무!
먼저 쓸데없는 코드들을 제거!
일단 카테고리 로고 이미지뷰와 상세보기 버튼, 상품권 태그와 관련된 코드 모두 지웠다.
그리고 가맹점 이름 레이블 위에 새로운 태그 레이블을 추가해서 UI 완성
태그 데이터 가져오기
cell.flagLabel.text = ShareMethods.shared.getShopType(CATE_GROUP: item.UPPER_CODE ?? " ")
Swift
복사
이게 정말 힘들었다.
새로 처음 만들었다면 그렇게 어렵지 않았을지도 모르지만, 기존의 코드를 이렇게 다시 고치는게 좀 빡셌다,,
일단 지도에서 가맹점 마커를 누르면 처리해주는 함수를 찾아서 그 안에,
// MerchantFinderVC.swift
} completion: { _ in
let itemCount = CGFloat(self.shopTableView.numberOfRows()) // shopTableView 행(row) 수
let padding = 8.0
let tag = 46.0
let bottomConstraint = 20.0
let shopNameHeight = cell?.shopNameLb.frame.size.height
let subShopNameHeight = cell?.subShopNameLb.frame.size.height
let heightContact = CGFloat(cell?.heightContactConstraint.constant ?? 0)
let tableHeight = tag + CGFloat(shopNameHeight ?? 0) + CGFloat(subShopNameHeight ?? 0) + CGFloat(bottomConstraint) + heightContact + (padding * 2)
// shopTableView의 전체 높이
let tableContentHeight = (itemCount > 1) ? 276.0 : tableHeight // 셀이 하나 이상이라면 고정된 276.0을 사용하고, 그렇지 않으면 tableHeight를 사용
currentTrackerBtnCon = tableContentHeight + spacePaddingBottomMap // 네이버맵 현재위치 버튼 Constraints
if (itemCount > 1) {
cell?.heightLineConstraint.constant = 1
} else {
cell?.heightLineConstraint.constant = 0
}
self.shopTableViewHeightCon.constant = tableContentHeight
self.currentLocationTrackerButtonBottomCon.constant = currentTrackerBtnCon
if UIAccessibility.isVoiceOverRunning { // VoiceOver가 실행 중일 경우, mapViewBottomCon의 제약 조건을 업데이트한다.
self.mapViewBottomCon.constant = tableContentHeight + 20.0 + 14.0
}
let moveUp = moveUpHeight
self.mapView.contentInset = UIEdgeInsets(top: 0, left: 8, bottom: moveUp, right: 0)
UIView.animate(withDuration: 0.2) {
self.shopDetailWrapperView.alpha = 1
self.changeColorLocationFindingWrapperView(isColor: true)
self.view.layoutIfNeeded()
}
self.shopTableView.fadeIn()
}
// MerchantShopCustomCell.swift
func configCell(item: SRCH_000001.Response.SAME_DIS_COMP_REC) {
self.shopNameLb.setTextWithLineHeight(text: item.COMPANY_NM, lineHeight: 24)
let subStr = (item.ADDR1 ?? "") + " " + (item.ADDR2 ?? "")
self.subShopNameLb.setTextWithLineHeight(text: subStr, lineHeight: 22)
}
Swift
복사
특정 UITableView와 관련된 뷰의 레이아웃과 애니메이션을 설정하였다.