diff --git a/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift b/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift index ce44d70b..d418e356 100644 --- a/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift +++ b/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift @@ -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) + } + } +}