FUIMapToolbarButton
@MainActor
open class FUIMapToolbarButton : FUIButton
FUIMapToolbarButton inherits from the FUIButton class and appears within the FUIMapToolbar.
- Height and width are both set to 44
- Images should be set to 28 by 28 icons. Icons will be centered within the button.
- didSelectHandler can be set to add custom functionality on tap
Usage:
let toolbar = FUIMapToolbar(mapView: self.mapView)
let settingsButton = FUIMapToolbarButton()
settingsButton.isPersistentSelection = true
settingsButton.setImage(FUIIconLibrary.system.information.withRenderingMode(.alwaysTemplate), for: .normal)
settingsButton.didSelectHandler = { [weak self] button in
DispatchQueue.main.async {
let settings = DevMapSettingsViewController()
settings.dismissButton = button
let navController = UINavigationController(rootViewController: settings)
if !(UIDevice.current.userInterfaceIdiom == .phone) {
settings.modalPresentationStyle = .formSheet
navController.modalPresentationStyle = .formSheet
self.present(navController, animated: true, completion: nil)
} else {
navController.modalPresentationStyle = .overFullScreen
let dismissClosure: (() -> Void)? = { [weak self] in
self.dismiss(animated: true, completion: nil)
}
settings.dismissClosure = dismissClosure
self.present(navController, animated: true, completion: nil)
}
}
}
toolbar.items = [settingsButton]
Notes
- Subclass the
FUIMapToolbarButtonfor custom variants
See
See provided default variants:FUIMapToolbarSettingsButton, FUIMapToolbarUserLocationButton, FUIMapToolbarZoomExtentButton, and FUIMapToolbarLegendButton
See
SeeFUIMapToolbarSettingsButton documentation for supplementary DevMapSettingsViewController class
-
Button type for FUIMapToolbarButton. Default is plain.
Declaration
Swift
@MainActor public private(set) var type: FUIMapToolbarButtonType { get } -
Public initializer for FUIMapToolbarButton for different types and stlyes. Instantiates with a frame of zero.
Declaration
Swift
@MainActor public init(type: FUIMapToolbarButtonType)Parameters
typeFUIMapToolbarButtonTypefor initializing with different styles -
A convenience initializer for the
FUIMapToolbarButton. Instantiates with a frame of zero.Declaration
Swift
@MainActor required public init()