sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: iOS7 alternative -


help me please find alternative deprecated method...

cgsize size = [title sizewithfont:buttonfont                                   minfontsize:10                                actualfontsize:nil                                      forwidth:_view.bounds.size.width                                 linebreakmode:nslinebreakbyclipping]; 

can (boundingrectwithsize:options:attributes:context:) this? this...

    nsdictionary *attributes = [nsdictionary dictionarywithobjectsandkeys:                                 [uifont systemfontofsize:10], nsfontattributename,                                 nil];      cgsize size = [title boundingrectwithsize:cgsizemake(_view.bounds.size.width-kborder*2, _view.bounds.size.height)                                       options:nslinebreakbyclipping                                    attributes:attributes                                       context:nil].size; 

am right? looking forward advices :)

have previous answer made here using code :

- (cgsize)text:(nsstring *)text sizewithfont:(uifont *)font constrainedtosize:(cgsize)size {     if (system_version_greater_than_or_equal_to(7.0))     {         nsdictionary *attributesdictionary = [nsdictionary dictionarywithobjectsandkeys:                                           font, nsfontattributename,                                           nil];          cgrect frame = [text boundingrectwithsize:size                                           options:(nsstringdrawinguseslinefragmentorigin | nsstringdrawingusesfontleading)                                        attributes:attributesdictionary                                           context:nil];          return frame.size;     }     else     {         return [text sizewithfont:font constrainedtosize:size];     } } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -