【发布时间】:2015-11-21 10:17:46
【问题描述】:
我正在研究通用应用程序。
我为此使用了大小类,但我遇到了一些与自定义字体相关的问题。
我已经创建了自定义标签类并将其应用于 UILabel。 下面是我的 MyLabel.h 文件。
MYLabel.h
#import <UIKit/UIKit.h>
@interface MyLabel : UILabel
@end
下面是我的 MyLabel.m 文件。
#import "MyLabel.h"
@implementation MyLabel
- (void)drawRect:(CGRect)rect {
}
-(void)awakeFromNib {
UIFont *custom = [[UIFont alloc] init];
custom = [UIFont fontWithName:@"MyriadPro-SemiboldIt" size:18];
self.font = custom;
}
@end
之后,我将 MyLabel 课程交给了 UILabel。
并根据下图设置属性。
虽然我看不到字体的变化,但 Ipad 和 Iphone 显示相同的字体。
请帮帮我。我是尺码课程的新手。
提前致谢。
【问题讨论】:
-
先过一遍这个:codewithchris.com/…。可能是设置自定义字体的问题。
t shows same font for Ipad and Iphone你想要每个设备有两种不同的字体吗? -
我认为您在右侧面板中看不到自定义字体。因此,您需要为设备特定字体设置条件。 注意:假设自定义字体加载正确。
标签: ios objective-c iphone xcode6 size-classes