Created
January 30, 2015 06:53
-
-
Save adek05/c3d237cf5f59427870ac 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
var angle = 0.0 | |
for view in uiViews { | |
viewContainer.addSubview(view) | |
var sine: CGFloat = CGFloat(sin(Float(angle))) | |
var cosine: CGFloat = CGFloat(cos(Float(angle))) | |
var r: CGFloat = view.superview!.frame.height / 2.0 | |
var x: CGFloat = sine * r | |
var y: CGFloat = cosine * r | |
layout (view) { view in | |
view.centerX == view.superview!.centerX + Float(x) | |
view.centerY == view.superview!.centerY + Float(y) | |
// set some size for the views | |
view.height == 75 | |
view.width == 75 | |
} | |
angle += Double((360.0 / Double(uiViews.count)) * 3.14/180.0) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment