Son*_*y G 1 deprecated ios7 drawinrect
我使用的是一个库(SGInfoAlert),它使用了弃用的代码drawInRect:r withFont:.我尝试更改一些代码以在iOS 7中修复它,但文本没有显示.谁知道为什么会这样?
// Changed this
//[info_ drawInRect:r withFont:[UIFont systemFontOfSize:kSGInfoAlert_fontSize]];
// To this
NSDictionary *textAttributes = @{NSFontAttributeName: [UIFont systemFontOfSize:kSGInfoAlert_fontSize]};
[info_ drawInRect:r withAttributes:textAttributes];
Run Code Online (Sandbox Code Playgroud)
好.我发现了一个问题.
// iOS 7 fix
UIFont* font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
NSDictionary *attrs = @{ NSForegroundColorAttributeName : [UIColor whiteColor],
NSFontAttributeName : font,
NSTextEffectAttributeName : NSTextEffectLetterpressStyle};
[info_ drawInRect:r withAttributes:attrs];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2421 次 |
| 最近记录: |