[iOS] 생명주기를 활용한 앱 클론 프로그래밍

growing·2023년 1월 1일

iOS

목록 보기
6/15

📱 앱 클론 프로그래밍

  • 선정 앱 : 스타벅스

주요 컴포넌트

  • Tabbar Controller
  • Navigation Controller
  • ScrollView
  • Table View
  • Stack View

LifeCycle 활용

View 생명주기

  • viewDidLoad() 사용 - 앱 시작 시 광고 화면 modal형식 present

Scene 생명주기

  • sceneWillResignActive() - App Switcher 모드를 통해 inactive 상태로 전환직전 보호 화면으로 변경
  • sceneDidBecomeActive() — 앱이 다시 활성화될 때 보호 화면 사라짐 (superview에서 제거)

App 생명주기

  • application(_:didFinishLaunchingWithOptions:) - 앱 최초 실행시 호출. 앱 추적 권한 허용 팝업

✍️ 이슈 및 해결

  • ViewController의 viewDidLoad()에서 앱 실행시 광고 화면을 띄우려고 했으나 안됨 ➡️ 앱 실행시 광고 화면을 띄우는 코드를 DispatchQueue.main.async 안에 넣어주기
    override func viewDidLoad() {
            super.viewDidLoad()
            DispatchQueue.main.async {
            // 다른 뷰 컨트롤러로 이동.
                let ViewController_first = self.storyboard?.instantiateViewController(withIdentifier: "ViewController_first") as! ViewController_first
                
                ViewController_first.modalPresentationStyle = .fullScreen
                
                self.present(ViewController_first, animated: true ,completion: nil)
            }
            // 그림자 세팅
            setCircleViewShadow()
        
        }
  • 이 외 이슈들은 추후 보완 후 작성
profile
Hello, World!

0개의 댓글