iphone - UIButton setFont 在 iPhone 2G iOS 3.1.3 上失败

标签 iphone uibutton uifont

我的测试仪使用的是装有 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/

相关文章:

ios - 自定义形状可触摸区域

ios - UIButton 标签不可见

ios - 如何从 iOS 设置中检测动态字体大小变化?

swift - 向 NSMutableAttributedString 添加几个属性

iphone - 我怎样才能改变 UITextview 的内容

iphone - 当您打开谷歌地图 URL 时,您如何默认步行路线?

ios - 快速清除 UITextfield 按钮的自定义操作

iphone - obj.delegate=self 是什么意思?

iphone - 当我将图像放入按钮时,为什么 UIButton.titleLabel.text 会消失?

iphone - iPhone iOS4 内存泄漏?