开发者

UIButton setFont fails on iPhone 2G iOS 3.1.3

My tester has in iPhone 2G with iOS 3.1.3. The application crashes on his phone on this method:

- (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]];   
}        

And the Interface:

@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;

The 开发者_JAVA百科font is copied in the Resources folder and the "Info.plist" "Font provided by application" is set properly.

Any idea how to fix this?


According to documentation on UIKit Keys, custom fonts became available in iOS 3.2. This is most likely the reason for your code to fail on iOS 3.1.3 (or as it was called back in the day - iPhone OS 3.1.3).


First of all I would like to tell you that very few use iPhone 2G with iOS 3.1.3. In fact very few use anything below iOS 4.0. We usually don't support anything below 4.0 unless the customer explicitly requires it. If we find bugs on lower versions of iOS, we just drop support for that version, because it's just not worth the time it takes to fix it.

If you still decide that you want to fix this bug you're gonna have to provide the stack trace or it will be very hard for us to tell you what's going wrong.

EDIT: Just as Bartosz pointed out, you're using a feature that's not available in iOS 3.1.3. If you need custom fonts you will not be able to support anything below 3.2. iOS 3.2 is for iPad only, so if your app is iPhone only that means that you will not be supporting anything below 4.0. As I pointed out in my original answer most users use >=4.0 any way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜