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
Post a Comment