iOS: How do you measure the width and height of a string using Quartz?

On the iPhone SDK, there's a family of methods on NSString that provide what you want.

As of iOS 7.0, these methods are:

- boundingRectWithSize:options:attributes:context:
- sizeWithAttributes:

On older versions of iOS we had these, now deprecated:

– sizeWithFont:  
– sizeWithFont:forWidth:lineBreakMode:  
– sizeWithFont:constrainedToSize:  
– sizeWithFont:constrainedToSize:lineBreakMode:  
– sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: