---
title: "Detect PDF annotation changes on iOS"
canonical_url: "https://www.nutrient.io/guides/ios/annotations/detecting-if-annotations-have-changed/"
md_url: "https://www.nutrient.io/guides/ios/annotations/detecting-if-annotations-have-changed.md"
last_updated: "2026-05-30T02:20:01.301Z"
description: "Learn how to create, edit, and detect changes to PDF annotations in your iOS applications using Nutrient."
---

# Detect changes to PDF annotations in iOS apps

Nutrient enables you to edit and create annotations if your license includes this component. You can detect changes to the underlying data models by listening to the following notifications.

| Notification               | Description                                                                                                                                                      |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.PSPDFAnnotationsAdded`   | Sent when new annotations are added to the default `PDFFileAnnotationProvider`. Object posting is an array of new `Annotation(s)`.                               |
| `.PSPDFAnnotationsRemoved` | Sent when new annotations are removed from the default `PDFFileAnnotationProvider`. Object posting is an array of removed `Annotation(s)`.                       |
| `.PSPDFAnnotationChanged`  | Internal events to notify the annotation providers when annotations are being changed. Send only from main thread. Don’t call save during a change notification. |

Here’s an example of listening to changes of the contents in the note annotation controller:

### SWIFT

```swift

// Start listening to the annotation's change notification.
NotificationCenter.default.addObserver(self, selector: #selector(annotationChangedNotification(notification:)), name:.PSPDFAnnotationChanged, object: nil)

func annotationChangedNotification(notification: Notification) {
    // Check if we need to rerender ourselves.
    let changedAnnotation = notification.object as! Annotation
    if annotation == changedAnnotation, let keyPaths = notification.userInfo?[PSPDFAnnotationChangedNotificationKeyPathKey] as? [String] {
        if keyPaths.count > 1 || keyPaths.first!= "contents" {
            updateImage(animated: true)
        }
    }
}

```

### OBJECTIVE-C

```objc

// Start listening to the annotation's change notification.
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationChangedNotification object:nil];

- (void)annotationChangedNotification:(NSNotification *)notification {
    // Check if we need to rerender ourselves.
    if ([self.annotation isEqual:notification.object]) {
        NSArray *keyPaths = notification.userInfo[PSPDFAnnotationChangedNotificationKeyPathKey];
        if (keyPaths.count > 1 ||![keyPaths.firstObject isEqual:@"contents"]) {
            [self updateImageAnimated:YES];
        }
    }
}

```

In Nutrient, annotations are usually created using [`AnnotationStateManager`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/annotationstatemanager). If you create a drawing, the state manager is in the draw mode and will cache drawn lines until you exit the draw state, which will, in turn, cause an [`InkAnnotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/inkannotation) object to be created. After creation, an undo operation will remove the entire annotation — but while you’re in the drawing mode, undo/redo operates on a finer level, affecting one stroke at a time.

If you change annotations, make sure to also post appropriate change notifications. See our guide on [the annotation object model](https://www.nutrient.io/../../annotations/the-annotation-object-model/) for details.
---

## Related pages

- [Annotations object model on iOS](/guides/ios/annotations/the-annotation-object-model.md)
- [Define annotation behavior with flags on iOS](/guides/ios/annotations/annotation-flags.md)
- [Defining annotation blend modes on iOS](/guides/ios/annotations/annotation-blend-modes.md)
- [How to embed files in PDF annotations on iOS](/guides/ios/annotations/create-edit-and-remove/attach-a-file.md)
- [Setting annotation authors on iOS](/guides/ios/annotations/annotation-author-name.md)
- [Image picker: Add image annotations to PDFs on iOS](/guides/ios/miscellaneous/image-picker.md)
- [Disable PDF annotation editing for iOS users](/guides/ios/annotations/create-edit-and-remove/disable-editing.md)
- [Annotation state manager on iOS](/guides/ios/annotations/annotation-state-manager.md)
- [Undo and redo annotations on iOS](/guides/ios/features/undo-redo.md)
- [Drag-and-drop annotations on iOS](/guides/ios/annotations/create-edit-and-remove/drag-and-drop.md)
- [Z-index for annotation stacking order on iOS](/guides/ios/annotations/annotation-z-index.md)
- [Programmatically create PDF annotations on iOS](/guides/ios/annotations/programmatically-creating-annotations.md)

