私はこれが初心者の質問であることを知っていますが、私は初心者なので、ここに行きます:
私はアプリ全体(ボタン、ラベルなど)でChalkdusterフォントをかなり多く使用したいと考えており、これを実現するためにUILabelをサブクラス化しようとしました。Default.hには次のものがあります。
#import <UIKit/UIKit.h>
@interface Default : UILabel
{
UILabel *theLabel;
}
@property (nonatomic, strong) IBOutlet UILabel *theLabel;
@end
そしてこれは私の.mにあります:
#import "Default.h"
@implementation Default
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
UIFont *custom = [[UIFont alloc] init];
custom = [UIFont fontWithName:@"Chalkduster" size:18];
self.font = custom;
NSLog(@"h");
}
return self;
}
@end
Interface Builderでクラスを変更して実行すると、Chalkdusterフォントが表示されません。時間を大幅に節約できると信じているので、この設定を手伝っていただければ幸いです。乾杯。