Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

MacOS Scale to view
on iOS you can choose to scale to view to have the app resize the screen easily in the developer environment. Scale to view is however not easily done on MacOS using NS to solve on MacOS now. Is it possible for the Apple developer team to make this easier for the Developer, as I understand it is for iOS applications?
0
0
253
Feb ’25
Changing the font size of a row - view-base tableview
So I'm following this code here where I'm using a tableview to display the files contained in a folder along with a group cell to display the name of the current folder: Here's my tableView:isGroupRow method: method which basically turns every row with the folder name into a group row (which is displayed in red in the previous image ). -(BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { return YES; } return NO; } and here's my tableView:viewForTableColumn:row: method where I have two if statements to decide whether the current row is a group row (meaning it's a folder) or an image: -(NSView*)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; { DesktopEntity *entity = _tableContents[row]; if ([entity isKindOfClass:[DesktopFolderEntity class]]) { NSTextField *groupCell = [tableView makeViewWithIdentifier:@"GroupCell" owner:self]; [groupCell setStringValue: entity.name]; [groupCell setFont:[NSFont fontWithName:@"Arial" size:40]]; [groupCell setTextColor:[NSColor magentaColor]]; return groupCell; } else if ([entity isKindOfClass:[DesktopImageEntity class]]) { NSTableCellView *cellView = [tableView makeViewWithIdentifier:@"ImageCell" owner:self]; [cellView.textField setStringValue: entity.name]; [cellView.textField setFont:[NSFont fontWithName:@"Impact" size:20]]; [cellView.imageView setImage: [(DesktopImageEntity *)entity image]]; return cellView; } return nil; } Now, if the current row is an image, I change its font to Impact with a size of 40 and that works perfectly, the problem here is with the first IF statement, for a group row I wanted to change the font size to arial with a size of 40 with a magenta color but for some reason I can only get the color to work: You can see that my changes to the font size didn't work here, what gives? How can I change the font size for the group row ?
0
0
480
Nov ’24
Is it possible to automatically flip device orientation?
Hello togehter, i do have the following question. If I have my App run in landscape mode and a sheet view get's called, will it be possible to switch automatically from landscape mode in portrait mode and fix this device orientation? Once the sheet view get's dismissed or closed, the original view will come back and the device orientation shall switch back to landscape mode. Thanks you so much for your help!
0
0
231
Feb ’25
high internal cpu usage
Hi, I am developing a new SwiftUI app. Running under OSX, I see very high cpu usage (I am generating lots of gpu based updates which shouldn't affect the cpu). I have used the profiler to ensure my swift property updates are minimal, yet the cpu usage is high coming from SwiftUI. It seems the high cpu usage is coming from NSAppearance, specifically, CUICopyMeasurements - for a single button??? But the swift updates don't show any buttons being updating
Topic: UI Frameworks SubTopic: SwiftUI
0
0
261
Feb ’25
SwiftUI @Observable Causes Extra Initializations When Using Reference Type Properties
I've encountered an issue where using @Observable in SwiftUI causes extra initializations and deinitializations when a reference type is included as a property inside a struct. Specifically, when I include a reference type (a simple class Empty {}) inside a struct (Test), DetailsViewModel is initialized and deinitialized twice instead of once. If I remove the reference type, the behavior is correct. This issue does not occur when using @StateObject instead of @Observable. Additionally, I've submitted a feedback report: FB16631081. Steps to Reproduce Run the provided SwiftUI sample code (tested on iOS 18.2 & iOS 18.3 using Xcode 16.2). Observe the console logs when navigating to DetailsView. Comment out var empty = Empty() in the Test struct. Run again and compare console logs. Change @Observable in DetailsViewModel to @StateObject and observe that the issue no longer occurs. Expected Behavior The DetailsViewModel should initialize once and deinitialize once, regardless of whether Test contains a reference type. Actual Behavior With var empty = Empty() present, DetailsViewModel initializes and deinitializes twice. However, if the reference type is removed, or when using @StateObject, the behavior is correct (one initialization, one deinitialization). Code Sample import SwiftUI enum Route { case details } @MainActor @Observable final class NavigationManager { var path = NavigationPath() } struct ContentView: View { @State private var navigationManager = NavigationManager() var body: some View { NavigationStack(path: $navigationManager.path) { HomeView() .environment(navigationManager) } } } final class Empty { } struct Test { var empty = Empty() // Comment this out to make it work } struct HomeView: View { private let test = Test() @Environment(NavigationManager.self) private var navigationManager var body: some View { Form { Button("Go To Details View") { navigationManager.path.append(Route.details) } } .navigationTitle("Home View") .navigationDestination(for: Route.self) { route in switch route { case .details: DetailsView() .environment(navigationManager) } } } } @MainActor @Observable final class DetailsViewModel { var fullScreenItem: Item? init() { print("DetailsViewModel Init") } deinit { print("DetailsViewModel Deinit") } } struct Item: Identifiable { let id = UUID() let value: Int } struct DetailsView: View { @State private var viewModel = DetailsViewModel() @Environment(NavigationManager.self) private var navigationManager var body: some View { ZStack { Color.green Button("Show Full Screen Cover") { viewModel.fullScreenItem = .init(value: 4) } } .navigationTitle("Details View") .fullScreenCover(item: $viewModel.fullScreenItem) { item in NavigationStack { FullScreenView(item: item) .navigationTitle("Full Screen Item: \(item.value)") .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Cancel") { withAnimation(completionCriteria: .logicallyComplete) { viewModel.fullScreenItem = nil } completion: { var transaction = Transaction() transaction.disablesAnimations = true withTransaction(transaction) { navigationManager.path.removeLast() } } } } } } } } } struct FullScreenView: View { @Environment(\.dismiss) var dismiss let item: Item var body: some View { ZStack { Color.red Text("Full Screen View \(item.value)") .navigationTitle("Full Screen View") } } } Console Output With var empty = Empty() in Test DetailsViewModel Init DetailsViewModel Init DetailsViewModel Deinit DetailsViewModel Deinit Without var empty = Empty() in Test DetailsViewModel Init DetailsViewModel Deinit Using @StateObject Instead of @Observable DetailsViewModel Init DetailsViewModel Deinit Additional Notes This issue occurs only when using @Observable. Switching to @StateObject prevents it. This behavior suggests a possible issue with how SwiftUI handles reference-type properties inside structs when using @Observable. Using a struct-only approach (removing Empty class) avoids the issue, but that’s not always a practical solution. Questions for Discussion Is this expected behavior with @Observable? Could this be an unintended side effect of SwiftUI’s state management? Are there any recommended workarounds apart from switching to @StateObject? Would love to hear if anyone else has run into this or if Apple has provided any guidance!
0
0
306
Feb ’25
UICalendarView with decorations - change day height
Is there any way to change the height of the "day" cells in the UICalendarView? The view is very tall on the screen and I'd like to shorten it so I can put more content below it without using a scroll view. I'm using SwiftUI with a UICalendarView with UIViewRepresentable. The calendar will have default decorations to indicate a date with events.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
192
Feb ’25
Playground SwiftUI on iPad wont save .png image using fileExporter.
The SwiftUI Playground code below demonstrates that a .jpeg image can be read and written to the iOS file system. While, a.png image can only be read; the writing request appears to be ignored. Can anyone please tell me how to code to save a .png image using SwiftUI to the iOS file system. Code: import SwiftUI import UniformTypeIdentifiers /* (Copied from Playground 'Help' menu popup.) UIImage Summary An object that manages image data in your app. You use image objects to represent image data of all kinds, and the UIImage class is capable of managing data for all image formats supported by the underlying platform. Image objects are immutable, so you always create them from existing image data, such as an image file on disk or programmatically created image data. An image object may contain a single image or a sequence of images for use in an animation. You can use image objects in several different ways: Assign an image to a UIImageView object to display the image in your interface. Use an image to customize system controls such as buttons, sliders, and segmented controls. Draw an image directly into a view or other graphics context. Pass an image to other APIs that might require image data. Although image objects support all platform-native image formats, it’s recommended that you use PNG or JPEG files for most images in your app. Image objects are optimized for reading and displaying both formats, and those formats offer better performance than most other image formats. Because the PNG format is lossless, it’s especially recommended for the images you use in your app’s interface. Declaration class UIImage : NSObject UIImage Class Reference */ @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ImageFileDoc: FileDocument { static var readableContentTypes = [UTType.jpeg, UTType.png] static var writableContentTypes = [UTType.jpeg, UTType.png] var someUIImage: UIImage = UIImage() init(initialImage: UIImage = UIImage()) { self.someUIImage = initialImage } init(configuration: ReadConfiguration) throws { guard let data = configuration.file.regularFileContents, let some = UIImage(data: data) else { throw CocoaError(.fileReadCorruptFile) } self.someUIImage = some } func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper { switch configuration.contentType { case UTType.png: if let data = self.someUIImage.pngData() { return .init(regularFileWithContents: data) } case UTType.jpeg: if let data = self.someUIImage.jpegData(compressionQuality: 1.0) { return .init(regularFileWithContents: data) } default: break } throw CocoaError(.fileWriteUnknown) } } struct ContentView: View { @State private var showingExporterPNG = false @State private var showingExporterJPG = false @State private var showingImporter = false @State var message = "Hello, World!" @State var document: ImageFileDoc = ImageFileDoc() @State var documentExtension = "" var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text(message) Button("export") { if documentExtension == "png" { message += ", showingExporterPNG is true." showingExporterPNG = true } if documentExtension == "jpeg" { message += ", showingExporterJPG is true." showingExporterJPG = true } } .padding(20) .border(.white, width: 2.0) .disabled(documentExtension == "") Button("import") { showingImporter = true } .padding(20) .border(.white, width: 2.0) Image(uiImage: document.someUIImage) .resizable() .padding() .frame(width: 300, height: 300) } // exporter .png .fileExporter(isPresented: $showingExporterPNG, document: document, contentType: UTType.png) { result in switch result { case .success(let url): message += ", .\(documentExtension) Saved to \(url.lastPathComponent)" case .failure(let error): message += ", Some error saving file: " + error.localizedDescription } } // exporter .jpeg .fileExporter(isPresented: $showingExporterJPG, document: document, contentType: UTType.jpeg) { result in switch result { case .success(let url): message += ", .\(documentExtension) Saved to \(url.lastPathComponent)" case .failure(let error): message += ", Some error saving file: " + error.localizedDescription } } // importer .fileImporter(isPresented: $showingImporter, allowedContentTypes: [.png, .jpeg]) { result in switch result { case .failure(let error): message += ", Some error reading file: " + error.localizedDescription case .success(let url): let gotAccess = url.startAccessingSecurityScopedResource() if !gotAccess { message += ", Unable to Access \(url.lastPathComponent)" return } documentExtension = url.pathExtension guard let fileContents = try? Data(contentsOf: url) else { message += ",\n\nUnable to read file: \(url.lastPathComponent)\n\n" url.stopAccessingSecurityScopedResource() return } url.stopAccessingSecurityScopedResource() message += ", Read file: \(url.lastPathComponent)" message += ", path extension is '\(documentExtension)'." if let uiImage = UIImage(data: fileContents) { self.document.someUIImage = uiImage }else{ message += ", File Content is not an Image." } } } } }
0
0
309
Feb ’25
How to return a UIMenu for read-only UITextView
I have a UITextView being added at runtime to a UIImageView as the result of doing text recognition. It's set to be editable = NO and selectable = YES. When I set the text and select it, it asks the delegate for the menu to display via: textView:editMenuForTextInRange:suggestedActions: The suggested items contains many UIAction and UICommand objects that have private methods or do not have the destructive attribute set, yet they are destructive. Some of these are: promptForReplace: transliterateChinese: _insertDrawing: _showTextFormattingOptions: I need to return a menu that has only non-destructive commands in it. First, why isn't UITextView sending only non-destructive suggested commands when its editable is NO? Second, how can I filter the array of suggested commands when it's impossible to know if they're destructive (as some are missing that attribute)? In addition to that, even non-destructive commands are causing an unrecognized selector exception, such as the Speak command, which it is sending to my view controller instead of to the UITextView, which is the only thing that knows what the text is that it should speak.
Topic: UI Frameworks SubTopic: UIKit
0
0
166
Feb ’25
Page Freeze Caused by Gesture
When pushing a page in the navigation, changing the state of interactivePopGestureRecognizer causes the page to freeze. Just like this: #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. CGFloat red = (arc4random_uniform(256) / 255.0); CGFloat green = (arc4random_uniform(256) / 255.0); CGFloat blue = (arc4random_uniform(256) / 255.0); CGFloat alpha = 1.0; // self.view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, 0, 100, 44); btn.backgroundColor = [UIColor redColor]; btn.center = self.view.center; [btn setTitle:@"push click" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; } - (void)click:(id)sender { [self.navigationController pushViewController:[ViewController new] animated:YES]; } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; self.navigationController.interactivePopGestureRecognizer.enabled = NO; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; self.navigationController.interactivePopGestureRecognizer.enabled = YES; } @end
0
0
309
Feb ’25
NavigationSplitView does not work inside NavigationStack
When using a NavigationSplitView within a NavigationStack, the NavigationSplitView does not work as expected on iOS 18 (it worked previously). Items do not show their associated detail views when selected. See the following minimum reproducible example: import SwiftUI struct ContentView: View { @State var selectedItem: String? = nil @State var navigationState: NavigationState? = nil var body: some View { NavigationStack { List(selection: self.$selectedItem) { NavigationLink("Item 1", value: "item") } .navigationDestination(item: self.$selectedItem) { value in ChildView() } } } } enum NavigationState: Hashable { case general case secondary } struct ChildView: View { @State var navigationState: NavigationState? = nil var body: some View { NavigationSplitView { List(selection: self.$navigationState) { NavigationLink(value: NavigationState.general) { Text("Basic info") } NavigationLink(value: NavigationState.secondary) { Text("Secondary info") } } } detail: { if self.navigationState == nil { Text("Nothing") } else { Text("Details") } } } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
327
Nov ’24
NSTextField Delegates Not Triggering After Refactoring NSView to NSViewController in macOS App
I'm developing a macOS application and facing an issue with NSTextField delegates after refactoring my code. Here's the situation: I have an NSWindowController. Inside the NSWindowController, there's a container NSView named containerView. On top of containerView, I added a custom NSView subclass named MyDetailsView. MyDetailsView has two NSTextField instances, and their delegates are properly set. The delegate methods like controlTextDidChange(_:) were getting called as expected. Due to some additional requirements, I refactored MyDetailsView into MyDetailsViewController, a subclass of NSViewController. I created a corresponding .xib file for MyDetailsViewController. Updated the code to load and add MyDetailsViewController's view (view property) to containerView. Verified that the NSTextField delegates are still being set, and the fields are displayed correctly in the UI. However, after this refactor, the NSTextField delegate methods (e.g., controlTextDidChange(_:)) are no longer being triggered. **What I've Tried: ** Verified that the delegates for the NSTextField instances are correctly set after the refactor. Ensured that the MyDetailsViewController's view is added to containerView. Question: What could be causing the NSTextField delegate methods to stop working after refactoring from NSView to NSViewController? @IBOutlet weak var customeView: NSView! var myDetailsViewController: MyDetailsViewController! var myDetailsView: MyDetailsView! var isViewController: Bool = true override func windowDidLoad() { super.windowDidLoad() if isViewController { myDetailsViewController = MyDetailsViewController(nibName: "MyDetailsViewController", bundle: nil) self.customeView.addSubview(myDetailsViewController.view) } else { myDetailsView = MyDetailsView.createFromNib() self.customeView.addSubview(myDetailsView!) } } override func showWindow(_ sender: Any?) { super.showWindow(nil) window?.makeKeyAndOrderFront(nil) } override var windowNibName: NSNib.Name? { return NSNib.Name("MyWindowController") }} class MyDetailsViewController: NSViewController { @IBOutlet weak var textField: NSTextField! override func viewDidLoad() { super.viewDidLoad() // Do view setup here. } } extension MyDetailsViewController: NSTextDelegate { func controlTextDidChange(_ obj: Notification) { guard let textField = obj.object as? NSTextField else { return } print("The value is ----> (MyDetailsViewController) \(textField.stringValue)") } } TextField delegate is set in XIB.
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
368
Dec ’24
must use voip + livekit to developing, When incoming offline messages arrive at the device through VoIP, call ConversationManager The method of reporting NewIncomingConversation (uuid: update:) will crash in second or more time
now i must use voip + livekit to developing, When incoming offline messages arrive at the device through VoIP, call ConversationManager The method of reporting NewIncomingConversation (uuid: update:) only first time can push new system UI,second or more time will crash, and acrsh stack appears to indicate that callkit has not been called
Topic: UI Frameworks SubTopic: General
0
0
325
Feb ’25
NSDocumentController subclass with remembered document options
Hi all, I am trying to allow users of my app to select extra options when opening documents, and to remember those options when re-opening documents at launch. So far best idea I have is: Subclass NSDocumentController to provide an NSOpenPanel.accessoryView with the options Create a URL bookmark for each opened file and keep a mapping of bookmarks to options On launch and when the recent documents list changes, prune the stored mappings to match only the recent items Has anyone done this before, or know of a better approach? Thank you.
Topic: UI Frameworks SubTopic: AppKit
0
0
271
Feb ’25
Scrolling Table with children in SwiftUI for macOS app
How do I scroll to a row and select it when it is part of collapsed rows in Table ScrollViewReader { scrollViewProxy in Table([node], children: \.children, selection: $selectedNodeID) { TableColumn("Key") { Text($0.key) } TableColumn("Value") { Text($0.val) } } .onChange(of: selectedNodeID) { _, newValue in withAnimation { scrollViewProxy.scrollTo(newValue) } } } The code above works well for the rows that are expanded or at the root level. However, for the rows that are not yet expanded the code above does nothing. How can I update the code so that it scrolls to a row that has not materialized yet. Info: This is a macOS app I am on macOS 15.1.1 with Xcode 16.1 and the minimum target of the app is macOS 15
0
0
375
Nov ’24
How to steal focus from another app's text field?
I have written a calculator app. Its main window is a UIView subclass that usually receives user input from the touchscreen, tapping on a virtual keyboard (not the standard pop-up keyboard). I recently added hardware keyboard support. In order to receive key events, I implemented canBecomeFirstResponder and made it always return YES, and I'm calling becomeFirstResponder whenever the main window becomes active, and resignFirstResponder when it becomes inactive. This is working fine except for one scenario: when running the app on an iPad, together with another app, using Split View or Slide Over, and the other app has keyboard focus on a text field, my app doesn't receive keyboard events, even when it's the foreground app. I have to go into the other app, and tap somewhere outside a text field, and then return to my app, before my app is getting key events again. If the user taps on an actual text field in my app, it gets focus just fine, of course, but apparently my UIView calling becomeFirstResponder is not enough to take away the focus from the other app. Is there a way to steal the focus from another app's text field in this scenario?
Topic: UI Frameworks SubTopic: UIKit
0
0
292
Dec ’24
MSStickerView in SwiftUI not animating by default
I am working on a sticker app and I am building a custom sticker app in SwiftUI. I have created a custom UIViewRepresentable to allow a MSStickerView to be displayed in SwiftUI. I have local *.gif files in my project and I am loading them into the MSStickerView successfully, however when they are loaded in my iMessage sticker extension the stickers are not animating by default. When I tap on the MSStickerView the gif begins to animate, I'm not sure what else I can do to get this working properly in my app. Some sample code below: public struct CustomStickerView: UIViewRepresentable { var sticker: CustomSticker public init(sticker: CustomSticker) { self.sticker = sticker } public func makeUIView(context: Context) -> MSStickerView { let v = MSStickerView() if sticker.fileType == .gif { v.startAnimating() } return v } public func updateUIView(_ uiView: MSStickerView, context: Context) { uiView.sticker = sticker.sticker } } // CustomSticker public var sticker: MSSticker? { guard let imagePath = Bundle.main.path(forResource: name, ofType: ".\(fileType.rawValue)") else { print("Failed to get sticker - \(name).\(fileType.rawValue)") return nil } let path = URL(fileURLWithPath: imagePath) return try? MSSticker(contentsOfFileURL: path, localizedDescription: name) }
0
0
436
Nov ’24
Do the coordinates obtained by scanning a QR code with VNDetectBarcodesRequest match the coordinates of the finder pattern?
I am creating an application that uses VNDetectBarcodesRequest to read QR codes from images and adjust the image orientation to match that of the QR code finder pattern. The QR code was successfully read, and the coordinates of the QR code were obtained.Upon checking the obtained topLeft, topRight, and bottomLeft coordinates, they always seem to match the topLeft, topRight, and bottomLeft coordinates of the finder pattern. Is it specified that the coordinates of topLeft, topRight, and bottomLeft obtained with VNDetectBarcodesRequest match the topLeft, topRight, and bottomLeft of the finder pattern? Or do they just happen to match? I would appreciate it if you could tell me if the matching of coordinates is a specification. Thank you for your help.
0
0
306
Feb ’25
iOS18.childViewController lifecycle of UITabbarController does not execute
I have encountered a tricky problem and hope to receive help. My APP process does not exist, and then I click on the notification message of the APP to open it. At this time, my APP will first configure uitabbarccontroller, and then push the first (index=0) viewcontroller (A) from the tab to the notification message list viewcontroller (B). However, I found that on iOS18, the lifecycle of A (viewDidLoad) did not execute at the end of this process. I am sure this problem will occur stably on iOS18.1.1. Versions lower than iOS18 will not. Can someone tell me why this is?
0
0
406
Dec ’24
How to disable Dynamic Island expansion/interaction in SwiftUI Live Activity?
I have implemented a Live Activity with Dynamic Island support for my charging app. Currently, the Dynamic Island expands when tapped, but I want to disable this interaction completely. Here's my current implementation: **dynamicIsland: { context in DynamicIsland { // Expanded Regions DynamicIslandExpandedRegion(.leading) { // Leading expanded content } DynamicIslandExpandedRegion(.trailing) { // Trailing expanded content } DynamicIslandExpandedRegion(.bottom) { // Bottom expanded content } } compactLeading: { // Compact leading view content } compactTrailing: { // Compact trailing view content } minimal: { // Minimal view content } .keylineTint(Color.clear) }**
0
0
483
Nov ’24
UIDocumentBrowserViewController - adjust order and color of navigation bar items
I'm using UIDocumentBrowserViewController. This view controller automatically creates a TabView with navigation titles and up to two trailing navigation bar items. To visualize this, open the Files app by Apple on an iPhone. I want to do the following: Add a third button and place it farthest on the trailing side. Keep all three buttons blue (the default color), but adjust the color of the navigation title to use the primary text color (it is also currently blue, by default) Button Order If my button is represented by C, then the order from left-to-right or leading-to-trailing should be A B C. I tried to add it by using additionaltrailingnavigationbarbuttonitems: class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocumentBrowserViewControllerDelegate { override func viewDidLoad() { super.viewDidLoad() let button = UIBarButtonItem(...) additionalTrailingNavigationBarButtonItems.append(button) } } This always adds it as the leftmost trailing item. The order when the view loads is C A B, where C represents my button. Here are some things I've tried: Add it in viewWillAppear - same results. Add it in viewDidAppear - same results. Add it using rightBarButtonItems - does not show up at all. insert it at: 0 instead of appending it - same results. Add it with a delay using DispatchQueue.main.async - same results. After some experimentation, I realized that the arrays referenced by additionalTrailingNavigationBarButtons and rightBarButtonItems seem to be empty, other than my own button. This is the case even if the DispatchQueue delay is so long that the view has already rendered and the two default buttons are clearly visible. So I'm not sure how to place my button relative to these, since I can't figure out where they actually are in the view controller's properties. How do I put my button farther to the trailing/right side of these two default buttons? Title Color The navigation titles created by UIDocumentBrowserViewController are blue when not in their inline format. I want them to use the primary text color instead. In viewDidLoad, I could do something like this: UINavigationBar.appearance().tintColor = UIColor.label This will change the title color to white or black, but it will also change the color of the buttons. I've tried various approaches like titleTextAttributes, and none of them seem to work with this view controller. How do I change just the color of the navigation title, and not the color of the navigation bar items?
Topic: UI Frameworks SubTopic: UIKit
0
0
325
Jan ’25