0

I'm working on a project that has some items very similar to the Bedtime of iOS 10. However I'm stopped at an important point of the project:


What I have:

I have already drawn a dotted arc with a UIBezierPath.

enter image description here


What I need:

I need to add and align Labels as the central part of the Bedtime app.

enter image description here

What do I need to do and / or how can I add and align labels like the image below?

James
  • 1,167
  • 1
  • 13
  • 37
  • 4
    This is a math question, not Swift. You need to use sin and cos for calculating the label position (x, y) based on the label angle rotation and radius(distance from center). For instance, how to calculate the x position of a label. `let x = cos(angle) * (radius - max(yourLabel.frame.width, yourLabel.frame.height)) + view.center.x`. To calculate the y position you need to use same approach but use `sin` instead of `cos` – Leo Dabus Apr 17 '17 at 21:00
  • Forgot to mention the angle needs to be in radians http://stackoverflow.com/questions/29179692/how-can-i-convert-from-degrees-to-radians/29179878#29179878 and to calculate the y you need to use `view.center.y` – Leo Dabus Apr 17 '17 at 23:08

0 Answers0