iphone - Do NSMutableAttributedString addAttribute methods retain the passed in value? -


for example following code memory safe?

nsmutableattributedstring *str = ...;  ctfontref afont = ctfontcreatewithname((cfstringref)fontname, size, null); [str addattribute:(nsstring*)kctfontattributename value:(id)afont range:range]; cfrelease(afont); 

also, ctfontcreatewithname efficient call multiple times or should effort made cache ctfontref's same font/size?

i believe safe release font object after adding attribute. have done in own core text code , never have issues.

as caching, make sense keep font object around if used multiple times rather releasing , recreating many times. though, pre-optimisation, wouldn't make conscious effort yet. profile current code , decide whether or not microseconds worth work.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -