-
-
Save Pasanpr/6b47fd38c43cd554c3cb9b459df0c5e5 to your computer and use it in GitHub Desktop.
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
override func viewWillLayoutSubviews() { | |
if UIDevice.currentDevice().orientation == .LandscapeLeft || UIDevice.currentDevice().orientation == .LandscapeRight { | |
var rect = greenView.frame | |
rect.origin.x = 20 | |
rect.origin.y = 20 | |
rect.size.width = 307 | |
rect.size.height = 161.5 | |
greenView.frame = rect | |
rect = redView.frame | |
rect.origin.x = 340 | |
rect.origin.y = 20 | |
rect.size.width = 307 | |
rect.size.height = 161.5 | |
redView.frame = rect | |
rect = yellowView.frame | |
rect.origin.x = 20 | |
rect.origin.y = 193 | |
rect.size.width = 307 | |
rect.size.height = 161.5 | |
yellowView.frame = rect | |
rect = blueView.frame | |
rect.origin.x = 340 | |
rect.origin.y = 193 | |
rect.size.width = 307 | |
rect.size.height = 161.5 | |
blueView.frame = rect | |
} else { | |
var rect = greenView.frame | |
rect.origin.x = 25 | |
rect.origin.y = 44 | |
rect.size.width = 160 | |
rect.size.height = 299 | |
greenView.frame = rect | |
rect = redView.frame | |
rect.origin.x = 191 | |
rect.origin.y = 44 | |
rect.size.width = 160 | |
rect.size.height = 299 | |
redView.frame = rect | |
rect = yellowView.frame | |
rect.origin.x = 25 | |
rect.origin.y = 348 | |
rect.size.width = 160 | |
rect.size.height = 299 | |
yellowView.frame = rect | |
rect = blueView.frame | |
rect.origin.x = 191 | |
rect.origin.y = 348 | |
rect.size.width = 160 | |
rect.size.height = 299 | |
blueView.frame = rect | |
} | |
} |
Hi Pasan!
This code no longer appears to work in XCode Version 8.2.1 (8C1002).
Copy and pasted directly and getting tons of errors.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks Pasan .. i enjoy your swift course.