AliSoftware / AliSoftware/OHAttributedLabel

NSMutableAttributedString setFont functions crash with iOS 6 drawing functions

Open
#89 6 comments 0 reactions 0 assignees View on GitHub
Apple Bug
Dominant language
Objective-C
Stars
1.5k
Forks
341
PR merge metrics
No merged PRs in 30d

Description

Just a heads-up.

NSAttributedStrings with the font attribute set using the old Core Text functions (which the methods in the NSAttributedString attributes category included with this project use), when drawn using the new iOS 6 NSAttributedString drawing functions, will crash.

```
NSMutableAttributedString* foo = [NSMutableAttributedString attributedStringWithString:@"foo"];
[foo setFontName:@"Helvetica" size:13];
[foo boundingRectWithSize:CGSizeMake(320, 50) options:0 context:nil]; // CRASH
```

It appears that Apple assumed that the attribute value would be a UIFont object, when the documentation for the Core Text font attribute (still) says that it needs to be a CTFont object.

Although this is an iOS bug and not you guys' fault, you should probably still keep this in mind.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.