scaledValueForValue: called on a font that doesn't have a text style set

前端 未结 8 2076
暗喜
暗喜 2020-12-24 01:46

I am currently using the Xcode 6 pre release (not beta) and the simulator on OS X 10.10 Yosemite beta 7. I am trying to build a project developed in xcode 6, but the app cra

8条回答
  •  孤城傲影
    2020-12-24 01:56

    This problem has been fixed in iOS 8.1.

    Instead of spending time building a custom header/footer view, I just not apply the custom font to devices running iOS 8.0. Most people will probably have updated to iOS 8.1 anyway.

    I use the following code for this:

    NSOperatingSystemVersion iOS_8_1 = (NSOperatingSystemVersion){8, 1, 0};
    
    if (![[NSProcessInfo processInfo] respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]
        || [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:iOS_8_1]) {
        header.textLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:header.textLabel.font.pointSize];
    }
    

    The first statement is true if the device is running an iOS version lower than 8 (since isOperatingSystemAtLeastVersion: was introduced in iOS 8.0). The second statement is true if the device if running iOS 8.1 or later. With both statements we thus only exclude devices running iOS 8.0.

提交回复
热议问题