# Customize the annotation inspector on iOS

The annotation inspector ([`AnnotationStyleViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/annotationstyleviewcontroller)) is a Nutrient user interface (UI) component that allows you to change the different properties of an annotation. You can use it to customize selected annotations by changing their various appearance properties.

You can also customize the annotation inspector by providing a limited set of annotation properties to users for customization.

The `AnnotationStyle.Key` type includes the set of customizable properties.

## Customize annotation inspector properties

To change the properties available in the style inspector, simply set the [`propertiesForAnnotations`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfiguration/propertiesforannotations) property of the [`PDFConfigurationBuilder`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfigurationbuilder) as follows:

### SWIFT

```swift

let configuration = PDFConfiguration { builder in
  var annotationProperties = builder.propertiesForAnnotations

  annotationProperties[.ink] = [[AnnotationStyle.Key.lineWidth, AnnotationStyle.Key.color]]
  annotationProperties[.underline] = [[AnnotationStyle.Key.alpha]]
  annotationProperties[.line] = [[AnnotationStyle.Key.color, AnnotationStyle.Key.lineEnd1, AnnotationStyle.Key.lineEnd2]]
  annotationProperties[.square] = [[AnnotationStyle.Key.color, AnnotationStyle.Key.fillColor]]

  builder.propertiesForAnnotations = annotationProperties
}

```

### OBJECTIVE-C

```objc

PSPDFConfiguration *configuration = [PSPDFConfiguration configurationWithBuilder: ^(PSPDFConfigurationBuilder *builder) {
  NSMutableDictionary *annotationProperties = [builder.propertiesForAnnotations mutableCopy];

  annotationProperties[PSPDFAnnotationStringInk] = @[@[PSPDFAnnotationStyleKeyLineWidth, PSPDFAnnotationStyleKeyColor]];
  annotationProperties[PSPDFAnnotationStringUnderline] = @[@[PSPDFAnnotationStyleKeyAlpha]];
  annotationProperties[PSPDFAnnotationStringLine] = @[@[PSPDFAnnotationStyleKeyColor, PSPDFAnnotationStyleKeyLineEnd1, PSPDFAnnotationStyleKeyLineEnd2]];
  annotationProperties[PSPDFAnnotationStringSquare] = @[@[PSPDFAnnotationStyleKeyColor, PSPDFAnnotationStyleKeyFillColor]];

  builder.propertiesForAnnotations = annotationProperties;
}];

```

This can also be achieved by subclassing [`AnnotationStyleViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/annotationstyleviewcontroller) and overriding the [`properties(for:)`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/annotationstyleviewcontroller/properties(for:)) method to provide the properties for the different annotation types:

### SWIFT

```swift

override func properties(for annotations: [Annotation]) -> [[AnnotationStyle.Key]] {
    let defaultSections = super.properties(for: annotations)
    // Allow only a smaller list of known properties in the inspector popover.
    let supportedKeys: Set<AnnotationStyle.Key> = [.color,.alpha,.lineWidth,.fontSize]
    return defaultSections.map { propertiesInSection in
        return propertiesInSection.filter { property in
            return supportedKeys.contains(property)
        }
    }
}

```

### OBJECTIVE-C

```objc

- (NSArray<NSArray<PSPDFAnnotationStyleKey> *> *)propertiesForAnnotations:(NSArray<PSPDFAnnotation *> *)annotations {
    NSArray<NSArray<PSPDFAnnotationStyleKey> *> *defaultSections = [super propertiesForAnnotations:annotations];

    // Allow only a smaller list of known properties in the inspector popover.
    NSSet<PSPDFAnnotationStyleKey> *supportedKeys = [NSSet setWithObjects: PSPDFAnnotationStyleKeyColor, PSPDFAnnotationStyleKeyAlpha, PSPDFAnnotationStyleKeyLineWidth, PSPDFAnnotationStyleKeyFontSize, nil];

    NSMutableArray<NSArray<PSPDFAnnotationString> *> *newSections = [NSMutableArray array];
    for (NSArray *properties in defaultSections) {
        [newSections addObject:[properties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString *property, NSDictionary *bindings2) {
            return [supportedKeys containsObject:property];
        }]]];
    }
    return newSections;
}

```

Take a look at `PSCSimpleAnnotationInspectorExample.m` in [Nutrient Catalog](https://www.nutrient.io/../../getting-started/example-projects/#nutrient-catalog) for a complete example.

[`propertiesForAnnotations`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfiguration/propertiesforannotations) also accepts a block that takes an `Annotation` and returns an array of `AnnotationStyle.Key`s. This is useful when you want to customize the properties for a given annotation variant:

### SWIFT

```swift

// We need to explicitly use `@convention(block)`, as the `Array` is `id` typed.
typealias AnnotationStyleBlock = @convention(block) (Annotation) -> [[AnnotationStyle.Key]]
let styleBlock: AnnotationStyleBlock = { annotation in
    return [[AnnotationStyle.Key.color, AnnotationStyle.Key.fillColor]]
}
// Casting the Swift closure to `AnyObject`, since closures in Swift are not directly converted to Objective-C closures.
let blockObject = unsafeBitCast(styleBlock, to: AnyObject.self)
annotationProperties[.ink] = blockObject

```

### OBJECTIVE-C

```objc

PSPDFAnnotationStyleBlock styleBlock = ^PSPDFAnnotationStyleKeyGroupedList (PSPDFAnnotation *annotation) {
    return @[@[PSPDFAnnotationStyleKeyColor, PSPDFAnnotationStyleKeyFillColor]];
};
annotationProperties[PSPDFAnnotationStringSquare] = styleBlock;

```

To customize the color presets in the style inspector, check out our [customizing color presets](https://www.nutrient.io/../../annotations/customizing-presets/) guide.
---

## Related pages

- [Customizing lists of annotations on iOS](/guides/ios/customizing-the-interface/customizing-the-annotation-table-view-controller.md)
- [Customizing annotation color pickers on iOS](/guides/ios/customizing-the-interface/customizing-color-pickers.md)
- [Customizing the annotation toolbar on iOS](/guides/ios/customizing-the-interface/customizing-the-annotation-toolbar.md)

