UITextAttributeFont Key to the font in a text attributes dictionary. The corresponding value is an instance of UIFont. Use a font with size 0.0 to get the default font size for the current context. Available in iOS 5.0 and later. Deprecated in iOS 7.0. Declared in UIStringDrawing.h.
I am trying to get the width (height also desired) for a particular one-line string of text, and this is what I have now, "..." being what I need to appropriately initialize the font. The method is incomplete (it doesn't return a value), but I would like a non-deprecated way to specify a font's information and get back how many pixels wide the string would be if drawn.
-(float)getLength:(NSString *)text
{
CGSize size = [text sizeWithAttributes:[[NSDictionary alloc] initWithObjectsAndKeys:...];
}
Have the semantics changed from "Specify font details when you are making the final call" to "Specify font details once, and they will remain in effect until you change them to something else"?
Thanks,