From 9688000b6d2088b75a9ebd7b93f9e23c8f514c6d Mon Sep 17 00:00:00 2001 From: hryeong66 Date: Mon, 23 May 2022 22:38:34 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8[FEAT]=20#171=20-=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=B0=A8=20=EA=B7=B9=EC=9E=A5=20=EC=BD=94=EC=8A=A4=20=EB=B2=A0?= =?UTF-8?q?=EB=84=88=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/VCs/BannerScene/ThirdBannerVC.swift | 68 ++++++------------- 1 file changed, 22 insertions(+), 46 deletions(-) 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 d418e356..9d89a8c0 100644 --- a/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift +++ b/ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/BannerScene/ThirdBannerVC.swift @@ -15,55 +15,14 @@ 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 } + if imageViewList.count != 4 && buttonList.count != 2 { return } - view.addSubviews(imageViewList) - view.addSubviews(buttonList) + scrollView.addSubviews(imageViewList) + scrollView.addSubviews(buttonList) imageViewList[0].snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() @@ -121,11 +80,10 @@ final class ThirdBannerVC: BannerVC { $0.contentMode = .scaleAspectFit $0.clipsToBounds = true } - } private func initButtonList() { - for i in 0..<2 { + for i in 0...1 { let button = UIButton().then { $0.setTitle("드라이브 코스 바로가기", for: .normal) $0.titleLabel?.font = .notoSansMediumFont(ofSize: 14) @@ -137,4 +95,22 @@ final class ThirdBannerVC: BannerVC { buttonList.append(button) } } + + override func bind() { + super.bind() + guard buttonList.count == 2 else { return } + + buttonList[0].rx.tap + .asDriver() + .drive(onNext: { + print("첫번째 버튼 눌림") + }).disposed(by: disposeBag) + + buttonList[1].rx.tap + .asDriver() + .drive(onNext: { + print("두번째 버튼 눌림") + }).disposed(by: disposeBag) + + } }