[英]Status bar font changes in iOS 6.1
我有這個奇怪的問題,在iOS 7中,我的應用程序UIStatusBar
看起來像這樣:
但是在iOS 6.1中, UIStatusBar
看起來像這樣:
所以,我知道是什么問題,那是因為我重寫systemFontOfSize
和boldSystemFontOfSize
:
#import "UIFont+SytemFontOverride.h"
@implementation UIFont (SystemFontOverride)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;
{
return [UIFont fontWithName:@"ArialHebrew-Bold" size:fontSize];
}
+ (UIFont *)systemFontOfSize:(CGFloat)fontSize
{
return [UIFont fontWithName:@"Arial" size:fontSize];
}
#pragma clang diagnostic pop
@end
如何在不影響iOS6.1中的UIStatusBar
情況下覆蓋系統字體?
不不不!
不要使用這樣的類別,因為它具有意外的行為,您應該始終為類別方法命名。
例如
@implementation UIFont (OKASystemFontOverride)
+ (UIFont *)oka_boldSystemFontOfSize:(CGFloat)fontSize;
{
return [UIFont fontWithName:@"ArialHebrew-Bold" size:fontSize];
}
+ (UIFont *)oka_systemFontOfSize:(CGFloat)fontSize;
{
return [UIFont fontWithName:@"Arial" size:fontSize];
}
@end
然后,您必須在所有標簽上顯式設置字體。
myLabel.font = [UIFont oka_systemFontOfSize:17.f];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.