ios - Place UIViews in Circular fashion -
i creating graph interface different nodes , selected node @ center. created center node , drew circle mark location around subnodes placed.
i wanted place many nodes in circumference of circle without each overlapping other. how find how many can placed in circumference?
each of subnode views have same size. irrespective of that, arclength occupied each of sub nodes in circumference of circle different .
how find total no of controls size possible placed in circle's circumference particular radius . , how find center point of each subnodes placed in circle's circumference.
i know can use below formulas find angle traverse place subnodes. problem here arclength not fixed each subnode view.
2pirc/360 = arclength x = cx + r * cos(a) y = cy + r * sin(a)
i have solved problem using below formula mentioned in answer in thread in stackoverflow:
(x + r cos(2kπ/n), y + r sin(2kπ/n))
Comments
Post a Comment