Add a Bottom Inset to the User Interface in Swift for iOS

Make space for custom UI elements by adding a bottom inset and moving the document scrubber bar up.


//
// Copyright © 2021-2025 PSPDFKit GmbH. All rights reserved.
//
// The Nutrient sample applications are licensed with a modified BSD license.
// Please see License for details. This notice may not be removed from this file.
//
import PSPDFKit
import PSPDFKitUI
class InsetUserInterfaceExample: Example {
override init() {
super.init()
title = "Inset User Interface"
contentDescription = "Make space for custom UI elements"
category = .viewCustomization
priority = 410
}
override func invoke(with delegate: ExampleRunnerDelegate?) -> UIViewController? {
let document = AssetLoader.document(for: .annualReport)
let pdfController = InsetUserInteracePDFViewController(document: document)
return pdfController
}
}
private class InsetUserInteracePDFViewController: PDFViewController {
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
// Inset value of how much the scrubber bar should be moved up.
let bottomInset: CGFloat = 100
// Change the frame of the user interface view by moving it up
// the amount of bottomInset.
var userInterfaceFrame = self.view.bounds
userInterfaceFrame.size.height -= bottomInset
userInterfaceView.frame = userInterfaceFrame
}
}

This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.