O método sizeWithFont está obsoleto. boundingRectWithSize retorna um valor inesperado
No iOS7,sizeWithFont
está obsoleto, então estou usandoboundingRectWithSize
(que retorna um valor CGRect). Meu código:
UIFont *fontText = [UIFont fontWithName:[AppHandlers zHandler].fontName size:16];
// you can use your font.
CGSize maximumLabelSize = CGSizeMake(310, 9999);
CGRect textRect = [myString boundingRectWithSize:maximumLabelSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:fontText}
context:nil];
expectedLabelSize = CGSizeMake(textRect.size.width, textRect.size.height);
EmtextRect
, Estou ficando com um tamanho maior que o meumaximumLabelSize
, um tamanho diferente do que quando se usasizeWithFont
. Como posso resolver esse problema?