• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

How do I display 10 buttons in a circle in objective c using for loop?

Need a solution and please explain each line if you could. Many thanks.
0
charmingduck
Asked:
charmingduck
  • 4
  • 4
2 Solutions
 
Hamidreza VakilianSenior iOS DeveloperCommented:
Excuse me; what do you mean by displaying 10 buttons in a circle!?
0
 
charmingduckAuthor Commented:
in a round shape
0
 
charmingduckAuthor Commented:
like putting 10 apples around a round table.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Hamidreza VakilianSenior iOS DeveloperCommented:
For doing that you have to calculate the coordinates of 10 points placed on a circle with equal spaces. This is a calculus problem (finding 10 points on equation X^2 + Y^2 = K where the distance between each neighbor points is exactly the same)
iOS does not have a method which finds the points for you. You have to do it manually.
You may also try to do this in Interface Builder but unfortunately you cannot determine the precise position of each button.
0
 
charmingduckAuthor Commented:
do you know how to do it with a for loop?
0
 
Hamidreza VakilianSenior iOS DeveloperCommented:
As I said you have to first calculate 10 points coordinates. afterwards the for loop is quite easy then.
0
 
charmingduckAuthor Commented:
I think there is a smart way to draw this circle in code rather than entering the cords manually?
0
 
Hamidreza VakilianSenior iOS DeveloperCommented:
No I did not suggest you to calculate the coordinates manually. I meant you should write a function that take e.g. 3 parameters: CIRCLE_CENTER, CIRCLE_RADIUS, NO_OF_POINTS which utilizes a calculus-based algorithm to calculate the coordination of each point then return all those in an array. Afterwards you will write a for-loop to create 10 buttons by using the coordinates in that array.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now