Reputation: 1343
I was using a library (SGInfoAlert) which uses deprecated code drawInRect:r withFont:. I tried changing some codes to fix it in iOS 7 but the text doesn't show. Anyone knows why this is happening?
// Changed this
//[info_ drawInRect:r withFont:[UIFont systemFontOfSize:kSGInfoAlert_fontSize]];
// To this
NSDictionary *textAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:kSGInfoAlert_fontSize]};
[info_ drawInRect:r withAttributes:textAttributes];
Here is the git repository https://github.com/sagiwei/SGInfoAlert
Upvotes: 1
Views: 2508
Reputation: 1343
Ok. I found a fix.
// iOS 7 fix
UIFont* font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
NSDictionary *attrs = @{ NSForegroundColorAttributeName : [UIColor whiteColor],
NSFontAttributeName : font,
NSTextEffectAttributeName : NSTextEffectLetterpressStyle};
[info_ drawInRect:r withAttributes:attrs];
Upvotes: 8