我的测试仪使用的是装有 iOS 3.1.3 的 iPhone 2G。使用此方法,应用程序在他的手机上崩溃:
- (void) viewDidLoad
{
[super viewDidLoad];
[resumeGame.titleLabel setFont:[UIFont fontWithName:@"Old English Text MT" size:20.0]];
[startNewGame.titleLabel setFont:[UIFont fontWithName:@"Old English Text MT" size:20.0]];
[options.titleLabel setFont:[UIFont fontWithName:@"Old English Text MT" size:20.0]];
}
和界面:
@interface PuzzleViewController : UIViewController
{
IBOutlet UIButton *resumeGame;
IBOutlet UIButton *startNewGame;
IBOutlet UIButton *options;
}
@property (nonatomic, retain) IBOutlet UIButton *resumeGame;
@property (nonatomic, retain) IBOutlet UIButton *startNewGame;
@property (nonatomic, retain) IBOutlet UIButton *options;
字体已复制到资源文件夹中,并且“Info.plist”“应用程序提供的字体”已正确设置。
知道如何解决这个问题吗?
最佳答案
根据documentation on UIKit Keys ,自定义字体在 iOS 3.2 中可用。这很可能是您的代码在 iOS 3.1.3 上失败的原因(或者当天回调的 - iPhone OS 3.1.3)。
关于iphone - UIButton setFont 在 iPhone 2G iOS 3.1.3 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5449178/