From 25b0437734b99178c7c18cea1bea66cfeb0faf83 Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 15 Aug 2023 17:27:59 +0900 Subject: [PATCH 01/12] =?UTF-8?q?feat:=20=ED=99=94=EB=A9=B4=20=EB=AA=A8?= =?UTF-8?q?=EB=93=9C=20=EB=B3=80=EA=B2=BD=20=EB=B2=84=ED=8A=BC=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20AlertAction=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BoxOffice/Controller/MainViewController.swift | 30 +++++++++++++++++++ BoxOffice/View/Base.lproj/Main.storyboard | 13 ++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/BoxOffice/Controller/MainViewController.swift b/BoxOffice/Controller/MainViewController.swift index 053def1e..385922a7 100644 --- a/BoxOffice/Controller/MainViewController.swift +++ b/BoxOffice/Controller/MainViewController.swift @@ -11,7 +11,9 @@ final class MainViewController: UIViewController, CalendarViewControllerDelegate @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var loadingActivityView: UIActivityIndicatorView! @IBOutlet weak var calendarButton: UIButton! + @IBOutlet weak var changeModeButton: UIButton! var boxOffice: BoxOffice? + var isIconMode = false override func viewDidLoad() { super.viewDidLoad() @@ -23,6 +25,34 @@ final class MainViewController: UIViewController, CalendarViewControllerDelegate initRefresh() } + @IBAction func tapChangeModeButton(_ sender: Any) { + let actionSheet = UIAlertController(title: "화면모드변경", message: nil, preferredStyle: .actionSheet) + + let icon = UIAlertAction(title: "아이콘", style: .default) { action in + print("Selected icon") + self.isIconMode = true + self.collectionView.reloadData() + } + + let list = UIAlertAction(title: "리스트", style: .default) { action in + print("Selected list") + self.isIconMode = false + self.collectionView.reloadData() + } + + let cancel = UIAlertAction(title: "취소", style: .cancel) + + if isIconMode { + actionSheet.addAction(list) + } else { + actionSheet.addAction(icon) + } + + actionSheet.addAction(cancel) + + present(actionSheet, animated: true, completion: nil) + } + private func showLodingView() { collectionView.isHidden = true loadingActivityView.startAnimating() diff --git a/BoxOffice/View/Base.lproj/Main.storyboard b/BoxOffice/View/Base.lproj/Main.storyboard index 04080817..a9dcce69 100644 --- a/BoxOffice/View/Base.lproj/Main.storyboard +++ b/BoxOffice/View/Base.lproj/Main.storyboard @@ -2,7 +2,6 @@ - @@ -46,6 +45,15 @@ + @@ -58,7 +66,7 @@ -