NSAttributedString -boundingRectWithSize ignores size when it has a paragraph style

Originator:michele.titolo
Number:rdar://16128644 Date Originated:2/20/2014
Status:Open Resolved:
Product:iOS SDK Product Version:7.0.3
Classification:Other Bug Reproducible:Always
 
Summary:
I recently tried using boundingRectWithSize:options:context: to calculate a NSAttributedString size. It ignores the original frame size. I pass in a frame size 100 x 100 and it will return 1946.7 x 83.5. This is only a problem when the attributed string has a NSParagraphStyle attribute.

Steps to Reproduce:
1. Build and Run the sample app attached
2. Tap "Run" on the screen, app will log results of calculation to console (larger than 100 x 100)
3. Toggle the switch to remove the paragraph style
4. Tap "Run" again, app will log new, expected, result to console

Expected Results:
I do not expect boundingRectWithSize:options:context: to return a CGRect with a size larger than the size passed in.

Actual Results:
It returns an extremely large and incorrect CGRect.

Attachment:
https://github.com/mtitolo/RectBug

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!