ios - UIButton、Mapbox、以编程方式打开新 View

标签 ios swift uibutton mapbox

我是初学者,有一样东西是看不懂的。 在这个example存在信息按钮。据我了解,有一段代码返回此按钮:

  func mapView(_ mapView: MGLMapView, rightCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView? {
    return UIButton(type: .detailDisclosure)
}

所以问题是:如何以编程方式从此按钮打开另一个 View ( View 名称:extraInfo, View Controller 的名称:extraInfoController)? 拜托,你能详细回复吗,因为我已经很伤心了,我是初学者。 :) (我使用的是 Swift,不是 Obj-C)

最佳答案

你可以使用这个委托(delegate)方法

func mapView(_ mapView: MGLMapView, annotation: MGLAnnotation, calloutAccessoryControlTapped control: UIControl) {

}

关于ios - UIButton、Mapbox、以编程方式打开新 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43300384/

相关文章:

ios - 从自定义 uitableview 单元格获取 uitextfield 数据 - Swift

ios - 点击自定义 UITableViewCell 中的 UIButton 后更改模型

ios - 无法在属性初始值设定项中使用实例成员,将变量设置为惰性不起作用

IOS TableView 问题

ios - Delphi XE2 文件共享和 iOS

ios - 在 Xcode 8 中隐式展开可选分配

ios - 制作带有图像背景缩放到 iphone 大小的 UI 按钮

iphone - UIButton的addtarget : not called after touch it!

iOS SKProduct 如何获取IAP的免费试用信息?

iphone - Paypal 错误: FILE SYSTEM CHECK FAILED