UIViewController Lifecycle
UIViewController lifecycle, viewDidLoad, viewWillAppear, transitions, memory warnings
1What is the loadView method in the UIViewController lifecycle?
What is the loadView method in the UIViewController lifecycle?
คำตอบ
loadView is called to create the controller's root view. It is invoked before viewDidLoad and should only be overridden if the view is created programmatically without Interface Builder. It is the first stage of the lifecycle, ideal for building the root view hierarchy. Never call super.loadView() when overriding as it would load the default xib/storyboard.
2When is viewDidLoad called in the lifecycle?
When is viewDidLoad called in the lifecycle?
คำตอบ
viewDidLoad is called once after the view has been loaded into memory, after loadView. It is the ideal time to configure IBOutlets and initialize internal state. This method is never called again during the controller's lifetime.
3What is the role of viewWillAppear in the lifecycle?
What is the role of viewWillAppear in the lifecycle?
คำตอบ
viewWillAppear is called before the view is displayed on screen. It can be invoked multiple times during the controller's lifetime. It is the appropriate place to make changes that should happen each time the view appears, such as refreshing data.
What is the difference between viewWillAppear and viewDidAppear?
What is the purpose of viewWillDisappear?
+17 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ iOS อื่นๆ
Swift Basics
Swift Language Essentials
UIKit Fundamentals
UserDefaults & Keychain
Application Lifecycle
Auto Layout & Constraints
UITableView & UICollectionView
SwiftUI Basics
SwiftUI State Management
SwiftUI Navigation
Networking & URLSession
Codable & JSON Parsing
Core Data
Protocol Oriented Programming
MVVM Architecture
Push Notifications
Unit Testing & XCTest
UI Testing
Xcode & Build System
Swift Package Manager
Memory Management & ARC
Combine Framework
Concurrency & async/await
iOS Design Patterns
Performance Optimization
Security & Encryption
SwiftUI Advanced
iOS Application Architecture
เชี่ยวชาญ iOS สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี