I have the simple iOS app open the map from our enterprise portal by using ArcGIS Runtime SDK.
// MARK: - AGSGeoViewTouchDelegate
func geoView(_ geoView: AGSGeoView, didTapAtScreenPoint screenPoint: CGPoint, mapPoint: AGSPoint) {
print("AGSGeoViewTouchDelegate Event")
guard let featureLayer = self.featureLayer else { return }
print("featureLayer is not null")
// Identify the specified feature layer.
mapView.identifyLayer(featureLayer, screenPoint: screenPoint, tolerance: 12, returnPopupsOnly: false) { [weak self] (result: AGSIdentifyLayerResult) in
guard let self = self else { return }
if let error = result.error {
self.presentAlert(message: "Error Display Feature popup")
print(error)
} else if !result.popups.isEmpty {
// Unselect the previous feature.
featureLayer.clearSelection()
// Select the new feature.
let features = result.geoElements as? [AGSFeature]
let selectedFeature = features?.first
featureLayer.select(selectedFeature!)
// Display a popup only if it exists.
let popupsViewController = AGSPopupsViewController(popups: result.popups)
// Display the popup as a formsheet -- specified for iPads.
popupsViewController.modalPresentationStyle = .formSheet
// Present the popup.
popupsViewController.delegate = self
self.present(popupsViewController, animated: true)
}
}
}
In the popup, there is some content is a URL. I want to capture the movement when user tap on the link. I will do some other action or redirect to some where else. How can I do it?
Have you tried the wantsToShowViewController(ofType:) delegate method? I haven't tried it but if the type is AGSPopupViewControllerTypeWeb then you could take a custom action. If it's not, then you should still present the view controller using the parameters passed into the delegate method. Does that do what you need?
Nicholas,
Thank you. I am able to capture the event when user tap on the link. However, I also want to know the field that user tap on it also? Do you know anything about?
I have similar problem. I know wantsToShowViewController(ofType:) has parameter of wantsToShow svc:UIViewController. I want to get the _currentURL. I cannot get the property. I want to cast it to AGSWebViewController, but it complains the type is not in scope. Please help