
UIWindow::add 함수는 UIView 타입의 객체만 받을 수 있습니다. 따라서 UIView의 서브클래스인 UIView, UILabel, UIButton, UIImageView 등이 올 수 있습니다.
UIWindow::add 함수 대신에 addSubview 함수를 사용할 수 있습니다. addSubview 함수는 UIView 타입의 객체만 받을 수 있습니다.
#hostingforum.kr
swift
// 예시
let window = UIWindow(frame: UIScreen.main.bounds)
let label = UILabel()
label.text = "Hello, World!"
window.addSubview(label)
또한, UIView의 서브클래스인 UIView, UILabel, UIButton, UIImageView 등이 올 수 있습니다.
#hostingforum.kr
swift
// 예시
let window = UIWindow(frame: UIScreen.main.bounds)
let button = UIButton()
button.setTitle("Click me", for: .normal)
window.addSubview(button)
또한, UIView의 서브클래스인 UIView, UILabel, UIButton, UIImageView 등이 올 수 있습니다.
#hostingforum.kr
swift
// 예시
let window = UIWindow(frame: UIScreen.main.bounds)
let imageView = UIImageView(image: UIImage(named: "image"))
window.addSubview(imageView)
2025-06-04 22:59