1

我正在尝试将 UIView 添加为 MapKitAnnotation 的 leftCalloutAccessoryView,但我添加到 UIView 的文本标签没有显示,我不明白为什么?

let orderInfoView = UIView(frame: CGRectMake(0, 0, 100, annotationView!.frame.size.height))
orderInfoView.backgroundColor = UIColor.blackColor()

let textLabel = UILabel(frame: CGRectMake(0, 0, 100, 10))
textLabel.text = "Foobar"
textLabel.textAlignment = .Center

orderInfoView.addSubview(textLabel)

annotationView?.leftCalloutAccessoryView = orderInfoView

[更新]

这是破坏它的一段代码,将其更改为数字常量使其工作。

annotationView!.frame.size.height
4

0 回答 0