ios - How to make equal space between texts in the circular menu? -


i creating circular slider menu, using coregraphics draw control ui, here trying draw words on circumference of circle. cant able make spaces equally.

here code , output. please me give equal spaces between each word.

in drawrect

float anglestep = 2 * m_pi / [menuarray count]; float angle = degreestoradians(90); textradius = textradius - 12;  (nsstring* text in`enter code here` titlearray) {     [self drawstringatcontext:ctx string:text atangle:angle withradius:textradius];     angle -= anglestep; } 

//////////

- (void) drawstringatcontext:(cgcontextref) context string:(nsstring*) text atangle:(float)angle withradius:(float) radis  { cgsize textsize = [text sizewithfont:[uifont systemfontofsize:11.0]];  float perimeter = 2 * m_pi * radis; float textangle = textsize.width / perimeter * 2 * m_pi;  angle += textangle / 2;  (int index = 0; index < [text length]; index++)  {     nsrange range = {index, 1};     nsstring* letter = [text substringwithrange:range];     char* c = (char*)[letter cstringusingencoding:nsasciistringencoding];     cgsize charsize = [letter sizewithfont:[uifont systemfontofsize:11.0]];      float x = radis * cos(angle);     float y = radis * sin(angle);      float letterangle = (charsize.width / perimeter * -2 * m_pi);      cgcontextsavegstate(context);     cgcontexttranslatectm(context, x, y);     cgcontextrotatectm(context, (angle - 0.5 * m_pi));     cgcontextshowtextatpoint(context, 0, 0, c, strlen(c));     cgcontextrestoregstate(context);      angle += letterangle; } } 

output

enter image description here


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -