Create an Always-Dark Annotation Toolbar in Swift for iOS
Customize the Annotation Toolbar to always use Dark Mode UI using overrideUserInterfaceStyle
on iOS 13.
//// Copyright © 2019-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 PSPDFKitimport PSPDFKitUI
class AlwaysDarkAnnotationToolbarExample: Example {
override init() { super.init()
title = "Dark Annotation Toolbar" contentDescription = "Customize Annotation Toolbar to always use Dark Mode UI" category = .viewCustomization }
override func invoke(with delegate: ExampleRunnerDelegate) -> UIViewController { let document = AssetLoader.writableDocument(for: .welcome, overrideIfExists: false)
let pdfController = PDFViewController(document: document)
let annotationToolbar = pdfController.annotationToolbarController?.annotationToolbar
// Set the user interface style of the annotation toolbar to dark // to always use the dark mode appearance. annotationToolbar?.overrideUserInterfaceStyle = .dark
return pdfController }
}
This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.