Different font for MKAnnotationView

这一生的挚爱 提交于 2019-12-03 09:01:24

You will need to use MKAnnotationView, or subclass it, to change the appearance of the title and subtitle labels as you suggest. If you want to create more re-usable code, I'd subclass and add say properties to query and set the UIFont values to your UILabel instances.

Subclass the MKAnnotationView then put the category below on top of its implementation:

@implementation UIFont (SytemFontOverride)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"

+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize {

    return [UIFont fontWithName:@"Your-Font-Here" size:fontSize];
}

+ (UIFont *)systemFontOfSize:(CGFloat)fontSize {

    return [UIFont fontWithName:@"Your-Font-Here" size:fontSize];
}

#pragma clang diagnostic pop

@end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!