-2

I want to create a circular dial in swift. The entire circle is divided into images and I want to place those images to create a circle. Each image is clickable so that one image placed in centre of the arch could get change.

So I need to create circle using buttons in swift. Please note that I don't want to create a circular button, I want to create circle using button. Something like what is done in below link using labels.

Draw text along circular path in Swift for iOS

Mini2008
  • 627
  • 1
  • 6
  • 12

1 Answers1

0

Suppose we have n images to arrange around the circumference of a circle of radius r. The circle is 2π radians, so use polar coordinates from the center of the circle to find the points on the circumference at angles that are multiples of 2π/n. Now center the images (buttons) at those points.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thanks for the reply, i got it what you are saying(r,θ), but how can i calculate this formula in swift to find the polar coordinates.In the above example same thing is happening but they are using CGContext with just providing the angle and radius. – Mini2008 Jun 09 '18 at 21:05
  • I didn't ask for the code from scratch anyway but i got the formula now and my approach too, thanks :) – Mini2008 Jun 09 '18 at 21:15