【发布时间】:2020-01-28 17:10:07
【问题描述】:
我创建了一个自定义注释视图,如下所述:https://sweettutos.com/2016/03/16/how-to-completely-customise-your-map-annotations-callout-views/
它工作正常并显示正确的数据/信息。 问题似乎是添加的按钮对 .touchUpInside 没有响应。
let button = UIButton()
button.addTarget(self, action: #selector(ViewController.deleteFromAnnot(sender: )), for: .touchUpInside)
button.frame = CGRect.init(x: 16, y: 543, width: 268, height: 30)
button.backgroundColor = .yellow
calloutView.addSubview(button)
@objc func deleteFromAnnot(sender: UIButton)
{
print("Do something")
}
【问题讨论】:
标签: swift xcode annotations mkmapview selector