cgpathref - iOS: I can't get Core Text to use word wrapping. Where am I going wrong? -


i've attributed string multiple words. i'm trying draw along cgpathref using core text on ios7. however, when set ctlinebreakmode kctlinebreakbywordwrapping, text not wrap on words, on characters. instance, red, green, blue , purple pie slices have enough room display string using word wrapping, yet core text insists on wrapping on characters in cases. doing wrong?

enter image description here

    uifont *font = [uifont boldsystemfontofsize:10];  cgcontextsetlinewidth(context, 1.0); cgcontextsetstrokecolorwithcolor(context, [uicolor clearcolor].cgcolor); cgmutablepathref pathsmaller = cgpathcreatemutable(); cgcontextsetfillcolorwithcolor(context, [uicolor clearcolor].cgcolor); cgpathmovetopoint(pathsmaller, null, self.center.x, self.center.y); cgpathaddarc(pathsmaller, null, self.center.x, self.center.y, radius - 5, (beginangle - 90 - 1) * m_pi / 180, (endangle - 90 - 1) * m_pi / 180, no); cgpathclosesubpath(pathsmaller); cgcontextaddpath(context, pathsmaller);  cgcontextfillpath(context);  ctlinebreakmode linebreakmode = kctlinebreakbywordwrapping; ctparagraphstylesetting settings[] = {     { kctparagraphstylespecifierlinebreakmode, sizeof(ctlinebreakmode), &linebreakmode }, };  ctparagraphstyleref pstyle = ctparagraphstylecreate(settings, 1); nsmutableattributedstring *attrstring = [[nsmutableattributedstring alloc] initwithstring:@"mortgage insurance"]; cfattributedstringsetattribute((cfmutableattributedstringref)attrstring, cfrangemake(0, [attrstring length]), kctparagraphstyleattributename, pstyle); cfrelease(pstyle);  ctframesetterref framesetter = ctframesettercreatewithattributedstring((cfattributedstringref)attrstring); ctframeref theframe = ctframesettercreateframe(framesetter, cfrangemake(0, [attrstring length]), pathsmaller, null); cfrelease(framesetter);  ctframedraw(theframe, context); cfrelease(theframe); 


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -