FUIMapToolbarButton

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 FUIMapToolbarButton for custom variants

See

See provided default variants: FUIMapToolbarSettingsButton, FUIMapToolbarUserLocationButton, FUIMapToolbarZoomExtentButton, and FUIMapToolbarLegendButton

See

See FUIMapToolbarSettingsButton documentation for supplementary DevMapSettingsViewController class
  • The color scheme of the button

    Declaration

    Swift

    @available(*, deprecated, message: "Will be unavailble in newer SDK version.")
    public override var backgroundColorScheme: FUIBackgroundColorScheme { get set }
  • Button type for FUIMapToolbarButton. Default is plain.

    Declaration

    Swift

    public private(set) var type: FUIMapToolbarButtonType { get }
  • Public initializer for FUIMapToolbarButton for different types and stlyes. Instantiates with a frame of zero.

    Declaration

    Swift

    public init(type: FUIMapToolbarButtonType)

    Parameters

    type

    FUIMapToolbarButtonType for initializing with different styles

  • A convenience initializer for the FUIMapToolbarButton. Instantiates with a frame of zero.

    Declaration

    Swift

    required public init()