> For the complete documentation index, see [llms.txt](https://docs.mapsindoors.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mapsindoors.com/sdks-and-frameworks/ios/display-rules-in-practice/icon-zoom-scaling.md).

# Icon Zoom Scaling

Zoom-responsive Icon scaling with the iOS SDK v4

With Icon zoom scaling, Location Icons grow as the user zooms in, between two zoom levels set for the Solution. How much each Icon grows is the **Zoom scaling** value of its Display Rule. To learn how it works and how to set it up, read the CMS page [Icon Zoom Scaling](https://docs.mapsindoors.com/products/cms/display-rules/icon-zoom-scaling.md) first.

{% hint style="info" %}
Icon zoom scaling works with Mapbox only. Google Maps ignores it.
{% endhint %}

## Requirements

* iOS SDK **4.23.0** or later.
* A Solution with Icon zoom scaling turned on in the CMS.

## No code changes needed

The SDK reads the zoom range and the Zoom scaling values from the Solution's CMS configuration and scales the Icons itself. Updating the SDK is all that's needed.

## Changing Zoom scaling at runtime

Zoom scaling is the `iconZoomFactor` property of an `MPDisplayRule`. You can change it on the Main Display Rule, on a Location Type's Display Rule, or on a single Location's Display Rule:

```swift
// Let every Icon grow to twice its normal size.
MPMapsIndoors.shared.displayRuleFor(displayRuleType: .main)?.iconZoomFactor = 2

// Leave a Location Type out: its Icons keep their normal size.
MPMapsIndoors.shared.displayRuleFor(type: "Workstation")?.iconZoomFactor = 1

// Apply the change straight away.
mapControl.refresh()
```

`iconZoomFactor` must be greater than 0 and at most 4. Other values are ignored and logged, and the previous value is kept.

## Changing the zoom range at runtime

The zoom range comes from the CMS, but you can override it on `MPSolutionConfig`. Both values are MapsIndoors zoom levels:

```swift
let config = MPMapsIndoors.shared.solution?.config

// Grow Icons between zoom level 18 and 22.
config?.iconScaleZoomFrom = 18
config?.iconScaleZoomTo = 22

// Read the range in use. nil means Icon zoom scaling is off.
let band = config?.iconScaleZoomBand   // band.zoomFrom, band.zoomTo

// Turn Icon zoom scaling off.
config?.iconScaleZoomFrom = nil
config?.iconScaleZoomTo = nil

mapControl.refresh()
```

The range must satisfy 1 ≤ from < to ≤ 24. An invalid range turns Icon zoom scaling off; it is never corrected into a different range. Changes to the Solution config don't redraw the map by themselves, so call `refresh()` on your `MPMapControl` to apply them straight away.

## Markers drawn by your app

The SDK only scales what it draws. If your app draws its own callouts, labels or markers at a fixed offset from a MapsIndoors Icon, they won't move as the Icon grows and may overlap it. Contact MapsPeople support if you need help adjusting them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mapsindoors.com/sdks-and-frameworks/ios/display-rules-in-practice/icon-zoom-scaling.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
