🖥️
iOS App with Pop
UIKit Swift 5
UIKit Swift 5
  • iOS App development
  • Swift
    • Variable & Constant
    • Number & String
    • Operator
    • Array, Dictionary & Tuple
    • Enum
    • Optional
    • Function
    • Class & Struct
    • Branching
    • Loops
    • Error handler
    • Protocol
    • Extension
  • Create New Project
  • Introduction to Xcode
  • Scene-Based Life-Cycle
  • UIViewController
  • Storyboard
  • First Run
  • Display todo list
  • Basic Auto Layout
  • MVC
  • Model
  • Binding TableView
  • Binding TableViewCell
  • TableViewDelegate
  • Add navigationBar with + button
  • Add new item page
  • TextField and Switch
  • Binding action
  • Add mock item to todo list
  • What is weak?
  • Finish add item
  • Delete todo item
  • Edit todo item
  • Custom new layout
  • Adding new delegate
  • Refactor
  • Pushing edit view
  • Large navigation
  • Drag item
  • Drop item (in app)
  • Save data
  • Where to go from here?
Powered by GitBook
On this page

Scene-Based Life-Cycle

PreviousIntroduction to XcodeNextUIViewController

Last updated 2 years ago

วงจรของแต่ละหน้าจอ

โดยปกติจะมีสถานะใดสถานะหนึ่งใน 5 สถานะ โดยจะเริ่มจาก Unattached

เมื่อสั่งรันหน้าจอ จะเปลี่ยนมาอยู่ในสถานะ Foreground inactive ก่อนที่จะเข้าสู่สถานะ Foreground active เมื่อแสดงบนหน้าจอ เมื่อหน้าจอไม่ถูกโฟกัส จะเปลี่ยนมาอยู่ที่สถานะ Foreground inactive ก่อนที่จะกลายมาเป็น Background จากนั้นก็จะโดน System สั่งให้ Suspend สุดท้ายอาจถูกปิดไปแล้วกลับไปที่ Unattached

โดยที่เมื่อมีการเปลี่ยนสถานะต่าง ๆ UIKit จะเรียกผ่านไปให้ใครก็ตามที่เป็น UISceneDelegate ซึ่งจะว่าไปก็คือ SceneDelegate.swift นั่นเอง

อ่านรายละเอียดเพิ่มเติมได้ที่

Managing Your App's Life Cycle
แผนภาพแสดงสถานะต่าง ๆ ของหน้าจอ (Scene)