Skip to content

Instantly share code, notes, and snippets.

@adek05
Created January 30, 2015 06:53
Show Gist options
  • Save adek05/c3d237cf5f59427870ac to your computer and use it in GitHub Desktop.
Save adek05/c3d237cf5f59427870ac to your computer and use it in GitHub Desktop.
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