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 bubble, and would like to go with a different font face to match the rest of my application. However, I have not seen much mention of this, which has me concerned that it might not be possible.
I have seen the Building Custom Map Annotation Callouts tutorial, and I guess that would work. But, if at all possible I was hoping that the ability to change a font was built into the MKAnnotationView much the same way I can change the font of a UILabel without subclassing it.
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
来源:https://stackoverflow.com/questions/5328052/different-font-for-mkannotationview