【问题标题】:how can I change font size on MKAnnotation title and subtitle如何更改 MKAnnotation 标题和副标题的字体大小
【发布时间】:2016-05-17 00:21:19
【问题描述】:

如何更改 MKAnnotation 标题和副标题这是我的代码

 Newclass *ann1 = [[Newclass alloc] init];
ann1.title = namef1;
ann1.subtitle = @"";
ann1.coordinate = place1.center;
[mapView addAnnotation: ann1];

我搜索使用

UIFont *size = [UIFont systemFontOfSize:17];
CGSize textsize = [ann1.title sizeWithAttributes:@{NSFontAttributeName:size}];

但构建此代码显示未使用的变量 textsize

【问题讨论】:

  • 没有用于更改注释标注的标题/副标题字体的内置规定。

标签: ios objective-c mkannotation


【解决方案1】:

MKAnnotationMKAnnotationView 之间有明显的区别。您将无法以您希望的方式自定义订阅 MKAnnotationProtocol 的对象,因为MKAnnotation 协议仅要求对象维护变量以存储稍后将由MKAnnotationView 对象绘制的信息。

我建议您编写一个自定义的 MKAnnotationView 子类,其中包含自定义字体、大小和适用于您希望注释外观的任何其他内容。

This tutorial might help you out.

【讨论】:

  • 这个答案对你有帮助吗?
猜你喜欢
  • 2016-08-23
  • 2011-09-03
  • 2020-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-05
  • 2022-11-13
  • 1970-01-01
相关资源
最近更新 更多