Created
July 20, 2020 06:53
-
-
Save simrandotdev/9c40bad12424e7b87c605932d5cd0c6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func boundsAndCenter() { | |
| // Do any additional setup after loading the view. | |
| let v1 = UIView(frame: CGRect(x: 110, y: 110, width: 130, height: 200)) | |
| v1.backgroundColor = .green | |
| let v2 = UIView(frame: v1.bounds.insetBy(dx: 10, dy: 10)) | |
| v2.backgroundColor = .red | |
| view.addSubview(v1) | |
| v1.addSubview(v2) | |
| // v2.bounds.size.height += 20 | |
| // v2.bounds.size.width += 20 | |
| print(view.frame) | |
| print(v1.frame) | |
| print(v2.frame) | |
| print(v2.bounds) | |
| // v1.bounds.origin.x += 10 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment