Skip to content

Commit

Permalink
✅[CHORE] #210 - 기본 ui 구성과 프로퍼티 수정 중
Browse files Browse the repository at this point in the history
  • Loading branch information
hryeong66 committed May 17, 2022
1 parent 7ea50e3 commit 81396cf
Showing 1 changed file with 133 additions and 1 deletion.
134 changes: 133 additions & 1 deletion ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,136 @@
// Created by 장혜령 on 2022/05/17.
//

import Foundation
import UIKit

import SnapKit
import Then

final class ThirdBannerVC: BannerVC {

private var imageViewList: [UIImageView] = []
private var buttonList: [UIButton] = []

private let firstImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.clipsToBounds = true
$0.image = ImageLiterals.imgCarTheaterCourse1
}

private let secondImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.clipsToBounds = true
$0.image = ImageLiterals.imgCarTheaterCourse2
}

private let thirdImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.clipsToBounds = true
$0.image = ImageLiterals.imgCarTheaterCourse3
}

private let fourImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.clipsToBounds = true
$0.image = ImageLiterals.imgCarTheaterCourse4
}

private let shortcutButton = UIButton().then {
$0.setTitle("드라이브 코스 바로가기", for: .normal)
$0.titleLabel?.font = .notoSansMediumFont(ofSize: 14)
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .blue
$0.layer.cornerRadius = 8
}

private let shortcutButton2 = UIButton().then {
$0.setTitle("드라이브 코스 바로가기", for: .normal)
$0.titleLabel?.font = .notoSansMediumFont(ofSize: 14)
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .blue
$0.layer.cornerRadius = 8
}

override func setConstraints() {
super.setConstraints()

initImageViewList()
initButtonList()
guard imageViewList.count != 4 && buttonList.count != 2 else { return }

view.addSubviews(imageViewList)
view.addSubviews(buttonList)

imageViewList[0].snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview()
$0.centerX.equalToSuperview()
$0.height.equalTo(imageViewList[0].frame.height * viewRetio)
}

imageViewList[1].snp.makeConstraints {
$0.top.equalTo(imageViewList[0].snp.bottom)
$0.leading.trailing.equalToSuperview()
$0.centerX.equalToSuperview()
$0.height.equalTo(imageViewList[1].frame.height * viewRetio)
}

buttonList[0].snp.makeConstraints {
$0.top.equalTo(imageViewList[1].snp.bottom)
$0.leading.trailing.equalToSuperview().inset(93)
$0.height.equalTo(32 * viewRetio)
}

imageViewList[2].snp.makeConstraints {
$0.top.equalTo(buttonList[0].snp.bottom)
$0.leading.trailing.equalToSuperview()
$0.centerX.equalToSuperview()
$0.height.equalTo(imageViewList[2].frame.height * viewRetio)
}

buttonList[1].snp.makeConstraints {
$0.top.equalTo(imageViewList[2].snp.bottom)
$0.leading.trailing.equalToSuperview().inset(93)
$0.height.equalTo(32 * viewRetio)
}

imageViewList[3].snp.makeConstraints {
$0.top.equalTo(imageViewList[2].snp.bottom).offset(100)
$0.leading.trailing.bottom.equalToSuperview()
$0.centerX.equalToSuperview()
$0.height.equalTo(imageViewList[3].frame.height * viewRetio)
}

}

override func configureUI() {
super.configureUI()
}

private func initImageViewList() {
imageViewList.append(contentsOf: [ UIImageView(image: ImageLiterals.imgCarTheaterCourse1),
UIImageView(image: ImageLiterals.imgCarTheaterCourse2),
UIImageView(image: ImageLiterals.imgCarTheaterCourse3),
UIImageView(image: ImageLiterals.imgCarTheaterCourse4)
])

imageViewList.forEach {
$0.contentMode = .scaleAspectFit
$0.clipsToBounds = true
}

}

private func initButtonList() {
for i in 0..<2 {
let button = UIButton().then {
$0.setTitle("드라이브 코스 바로가기", for: .normal)
$0.titleLabel?.font = .notoSansMediumFont(ofSize: 14)
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .blue
$0.layer.cornerRadius = 8
$0.tag = i
}
buttonList.append(button)
}
}
}

0 comments on commit 81396cf

Please sign in to comment.