<!--
{
  "availability" : [
    "iOS: 2.0.0 - 8.0.0",
    "iPadOS: 2.0.0 - 8.0.0",
    "macCatalyst: 13.1.0 - 13.1.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISplitViewControllerDelegate/splitViewController(_:willHide:with:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UISplitViewControllerDelegate(im)splitViewController:willHideViewController:withBarButtonItem:forPopoverController:"
  },
  "title" : "splitViewController(_:willHide:with:for:)"
}
-->

# splitViewController(_:willHide:with:for:)

Tells the delegate that the specified view controller is about to be hidden.

```
optional func splitViewController(_ svc: UISplitViewController, willHide aViewController: UIViewController, with barButtonItem: UIBarButtonItem, for pc: UIPopoverController)
```

## Parameters

`svc`

The split view controller that owns the specified view controller.

`aViewController`

The view controller being hidden.

`barButtonItem`

A button you can add to your toolbar.

`pc`

The popover controller that uses taps in `barButtonItem` to display the specified view controller.

## Discussion

When the split view controller rotates from a landscape to portrait orientation, it typically hides one of its view controllers. When that happens, it calls this method to coordinate the addition of a button to the toolbar (or navigation bar) of the remaining custom view controller. If you want the soon-to-be hidden view controller to be displayed in a popover, you must implement this method and use it to add the specified button to your interface.

---

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)