我正在尝试将多个参数传递给swift3代码中的UIButton选择器,如下所示:
func openMaps(longitude: CGFloat, latitiude: CGFloat) {
let googleMapsInstalled = UIApplication.shared.canOpenURL(URL(string: "comgooglemaps://")!)
var latitude = 29.2746
var longitude = 47.8433
if googleMapsInstalled {
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: "comgooglemaps-x-callback://" +
"?daddr=\(latitude),\(longitude)&directionsmode=bicycling&zoom=17")!)
} else {
}
} else {
Utility.showAlert(title: Constants.error, message: Constants.someThingWrong, delegate: self)
}
}
为了调用这个函数,我正在使用uibutton选择器,如下所示:
cell.viewInMap.addTarget(self, action: #selector(openMaps(longitude:shop.longitude!,latitiude:shop.latitude!)), for: .touchUpInside)
如何将多个参数传递给UIButton选择器?我哪里错了?