UIView as leftCalloutAccessoryView

时间:2015-11-30 14:05:25

标签: swift uiview swift2 mapkit mapkitannotation

我试图添加一个UIView作为MapKitAnnotation的leftCalloutAccessoryView,但我添加到UIView的textlabel没有显示,我不明白为什么?

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

[UPDATE]

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

annotationView!.frame.size.height

0 个答案:

没有答案