Created
April 26, 2020 15:57
-
-
Save alexnikol/a1f1ca88b3335b8b35c98393069a4760 to your computer and use it in GitHub Desktop.
Add sublayers to layer of UIView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: Creation of sublayer1 | |
let sublayer1 = CALayer() | |
sublayer1.frame = CGRect(x: 20, y: 20, width: 30, height: 30) | |
sublayer1.backgroundColor = UIColor.red.cgColor | |
// MARK: Creation of sublayer2 | |
let sublayer2 = CALayer() | |
sublayer2.frame = CGRect(x: 80, y: 80, width: 40, height: 40) | |
sublayer2.backgroundColor = UIColor.green.cgColor | |
//Adding of sublayers to view.layer | |
view.layer.addSublayer(sublayer1) | |
view.layer.addSublayer(sublayer2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment