Here is your method you want:
-(BOOL)isSystemFont:(UIFont *)font
{
return ([[font familyName] isEqualToString:[[UIFont systemFontOfSize:12.0f] familyName]])?YES:NO;
}
Or as an extension in Swift3
extension UIFont {
func isSystemFont() -> Bool {
return self.familyName == UIFont.systemFont(ofSize: 12.0).familyName
}
}
Above method will return as you need
if([self isSystemFont:systemFont1]) NSLog(@"SystemFont");
else NSLog(@"Custom Font");
if([self isSystemFont:customFont1]) NSLog(@"SystemFont");
else NSLog(@"Custom Font");
Output is
2014-03-04 15:48:18.791 TestProject[4031:70b] SystemFont
2014-03-04 15:48:18.791 TestProject[4031:70b] Custom Font