Different font for MKAnnotationView

前端 未结 2 1720
温柔的废话
温柔的废话 2021-02-11 04:14

On the callout bubble on the iPhone SDK\'s map, can the font be changed for the title and subtitle properties.

I am displeased with the default font shown in the callout

相关标签:
2条回答
  • 2021-02-11 04:19

    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.

    0 讨论(0)
  • 2021-02-11 04:25

    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
    
    0 讨论(0)
提交回复
热议问题