<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIView/willMove(toSuperview:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIView(im)willMoveToSuperview:"
  },
  "title" : "willMove(toSuperview:)"
}
-->

# willMove(toSuperview:)

Tells the view that its superview is about to change to the specified superview.

```
func willMove(toSuperview newSuperview: UIView?)
```

## Parameters

`newSuperview`

A view object that will be the new superview of the receiver. This object may be `nil`.

## Discussion

The default implementation of this method does nothing. Subclasses can override it to perform additional actions whenever the superview changes.

---

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)