Using special fonts in iphone 4, but not up to version 3.2

I use the external features of fonts for my application. Since external fonts are not supported in version 3.1, I would like to determine the name of the font in connection with the iOS that the program is running. I defined the variable MY_FONT_NAME in the Constants.h file as follows:

  //#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
  #ifdef __IPHONE_3_2
    #define MY_FONT_NAME @"ExternalFontName"    
  #else
    #define MY_FONT_NAME @"AppleGothic"
  #endif

I tried both the first and the second, without success, but always gets the value "externalFontName", even when running on device 3.1 ... and therefore, when I install the font in the shortcut I get an error

'NSInternalInconsistencyException', reason: 'Invalid parameter that does not satisfy: font! = Nil'

Does anyone know what the problem is? thanks in advance

+3
source share
3

, UIFont +fontWithName:size: / +familyNames +fontNamesForFamilyName:.

, , , iPad 3.2, iPhone 4.0.

+1

ok, , , .. ! :)

, - :

  if ([[UIDevice currentDevice] systemVersion] >= @"3.2") {
    return @"myExternalFontName";
} else {
    return @"AppleGothic";
}

- ?

+2

Eve Madrazo is close. You really need to:

if ([[[UIDevice currentDevice] systemVersion]doubleValue] >= 3.2) {

because string comparison does not shorten it.

+1
source

Source: https://habr.com/ru/post/1766792/


All Articles