我通过Mapbox在我的家庭服务器上提供了一些栅格图块。虽然Mapbox支持下载矢量Mapbox数据,但它没有下载该区域的相应栅格图块,因此我也找不到任何信息。有什么想法吗?
不确定是否很重要,但这是下载代码。它漂亮的样板,除了提示输入名字
var name = "My Map"
let alert = UIAlertController(title: "Please Enter A Save Name", message: "Letters and numbers only.", preferredStyle: .alert)
let doneAction = UIAlertAction(title: "Done", style: .default) { (_) in
name = alert.textFields![0].text!
self.startOfflineMapPackDownload(name: name)
}
doneAction.isEnabled = false
alert.addAction(doneAction)
alert.addTextField { (textField) in
textField.autocapitalizationType = UITextAutocapitalizationType.words
NotificationCenter.default.addObserver(forName: UITextField.textDidChangeNotification, object: textField, queue: OperationQueue.main, using:
{_ in
//prevents spaces, punctuation, or symboles
// textField.text = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines)
textField.text = textField.text?.trimmingCharacters(in: .newlines)
textField.text = textField.text?.trimmingCharacters(in: .punctuationCharacters)
textField.text = textField.text?.trimmingCharacters(in: .symbols)
// Being in this block means that something fired the UITextFieldTextDidChange notification.
// Access the textField object from alertController.addTextField(configurationHandler:) above and get the character count of its non whitespace characters
let textCount = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines).count ?? 0
let textIsNotEmpty = textCount > 0
// If the text contains non whitespace characters, enable the OK Button
doneAction.isEnabled = textIsNotEmpty
name = textField.text!
})
}
self.present(alert, animated: true, completion: {
print("completion block")
})
} else {
print("not zoomed in far enough")
let alertController = UIAlertController(title: "You are not zoomed in enough",
message: nil,
preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Okay", style: .cancel))
self.present(alertController, animated: true)
}