I am new in swift I am trying to used Roboto font. Roboto font is working in iPhone 6s but it is not working in iPhone XR. My Code is like this
#ifndef DICE_PrefixHeader_pch
#define DICE_PrefixHeader_pch
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_4 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 480.0)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
#define IS_IPHONE_6PLUS (IS_IPHONE && [[UIScreen mainScreen] nativeScale] == 3.0f)
#define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0)
#define IS_IPHONE_XR (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 1792.0)
GenralMethod.h
+(UIFont*)setFont:(NSString*)fontName ForiPhone6Plus:(CGFloat)iPhone6Plus iPhone6:(CGFloat)iPhone6 iPhoneXR:(CGFloat)iPhoneXR andiPhone:(CGFloat)iPhone;
GenralMethod.m
+(UIFont*)setFont:(NSString*)fontName ForiPhone6Plus:(CGFloat)iPhone6Plus iPhone6:(CGFloat)iPhone6 iPhoneXR:(CGFloat)iPhoneXR andiPhone:(CGFloat)iPhone
{
return [UIFont fontWithName:fontName size:IS_IPHONE_6_PLUS?iPhone6Plus:IS_IPHONE_XR?iPhoneXR:IS_IPHONE_5?iPhone:iPhone6];
}
[btnMessage.titleLabel setFont:[GeneralMethod setFont:@"Roboto-Light" ForiPhone6Plus:20.0 iPhone6:20.0 iPhoneXR:20.0 andiPhone:15.0]];
I added it in storyboard also but its is not working in iPhone XR.