<!--
{
  "availability" : [
    "iOS: 9.0.0 - 13.0.0",
    "iPadOS: 9.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "tvOS: 9.0.0 - 13.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/unregisterForPreviewing(withContext:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)unregisterForPreviewingWithContext:"
  },
  "title" : "unregisterForPreviewing(withContext:)"
}
-->

# unregisterForPreviewing(withContext:)

Unregisters a previously registered view controller identified by its context object.

```
func unregisterForPreviewing(withContext previewing: any UIViewControllerPreviewing)
```

## Parameters

`previewing`

The context object that was returned when you registered the view controller by calling the [`registerForPreviewing(with:sourceView:)`](/documentation/UIKit/UIViewController/registerForPreviewing(with:sourceView:)) method.

## Discussion

The system calls this method automatically when a 3D Touch-registered view controller is deallocated.

In some circumstances, you must explicitly call this method. This is the case if a registered view controller’s view hierarchy changes state, or if presenting a preview is otherwise no longer possible. In such cases, call this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)