I have the following:
-(float)getLength:(NSString *)text
{
UIFont *font = [UIFont fontWithName:@"Scurlock" size:20];
CGSize size = [text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font,
NSFontAttributeName, nil]];
return size.width;
}
This is generating a compile-time error: "No visible @interface for 'NSString' declares the selector 'sizeWithAttributes.'"
I've searched, and it looks like the message sizeWithAttributes is appropriate to get rendered dimensions to an NSString. However, Xcode seems to disagree.
Once a font is given, perhaps Verdana for development porpoises, how can/should I query a string's dimensions as they will be rendered?