나는 트위터 애니메이션 프로젝트를 연습으로한다. 마스크의 배경색을 변경하고 싶지만 윈도우 배경색을 변경하는 이유를 모르겠습니다. 여기 iOS에서 창 배경색을 설정할 때 마스크의 배경색이 변경되는 이유는 무엇입니까?
당신은 또한 마스크backgroundcolor
을 설정할 수 있습니다 AppDelegate에
에 내 코드
var mask: CALayer?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.mask = CALayer()
self.mask?.contents = UIImage(named: "twitter")?.cgImage
self.mask?.contentsGravity = kCAGravityResizeAspect
self.mask?.bounds = CGRect(x: 0, y: 0, width: 100, height: 100)
self.mask?.position = self.window!.center
self.window?.rootViewController?.view.layer.mask = self.mask
self.window?.backgroundColor = UIColor(red: 18/255, green: 145/255, blue: 242/255, alpha: 1) // Why?
return true
}
감사합니다. 알아 냈습니다. – ovo