Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Posts under UIKit subtopic

Post

Replies

Boosts

Views

Activity

UISlider valueChanged has uninitialized UIEvent
This issue was in the first iOS 26 beta and it still there with Xcode 26 beta 6 (17A5305f). Feedback is FB18581605 and contains sample project to reproduce the issue. I assign a target and action to a UISlider for the UIControl.Event.valueChanged value: addTarget(self, action: #selector(sliderValueDidChange), for: .valueChanged) Here’s the function. @objc func sliderValueDidChange(_ sender: UISlider, event: UIEvent) { print(event) } When printing the event value, there is a crash. When checking the event value with lldb, it appears uninitialized.
Topic: UI Frameworks SubTopic: UIKit Tags:
10
4
442
2h
iOS 26.1 UITableView separator style not working
Dear Apple Developer Support, We found that on devices running iOS 26.1 Beta, if we set the separator style of a UITableView to None via xib, the setting will have no effect and the table view cells will show separators. To reproduce this issue, I created a simple project. Please refer to the following screenshots. On iOS 26.0, no separator is showing. However on iOS 26.1, separators are showing. We have already filed a bug report FB20365301. We'd like to know if this is a bug and if it will be fixed before iOS 26.1 is officially released. Thank you.
Topic: UI Frameworks SubTopic: UIKit
3
6
339
10h
Recover iPadOS MenuBar state from different scenes
I’m building a Flutter plugin to access the new menubar API on iPadOS. Everything works fine with a single scene, but I’m running into issues when adding support for multiple scenes: Only odd-numbered windows (first, third, etc.) build their menus correctly. Even-numbered windows ignore the menus sent from Flutter and fall back to a default menubar. When switching between scenes, the last rendered menu always persists instead of updating to the current focus. So far, I’ve: Implemented the plugin as a singleton. Tried to persist menu state per scene, but without success. What would be the recommended approach here? Should I avoid a singleton and manage state entirely per UIScene instance? The project is open-source, and if anyone is willing to take a look, here are the relevant files: /ios/Classes/IpadOSMenubarPlugin.swift /example/ios/Runner/AppDelegate.swift Any guidance would be much appreciated.
1
0
76
20h
How to turn off background extension effect in UISplitViewController?
I have a triple-column UISplitViewController setup in "tile" mode. Each of the 3 columns has a table view controller. Under iPadOS 26, the section headers and row selection in the middle table extends all the way to the left of the screen, behind the primary column. It looks terrible. The documentation for "Adopting Liquid Glass" makes it sound like you can add this behavior by using UIBackgroundExtensionView. But I get this behavior automatically in a UISplitViewController. How do I turn this off? I created a simpler sample using a double-column split view with two table view controllers. Here's a screenshot of the result: Note how the section headers and the row selection appear all the way to the left edge of the screen. I don't want that effect. How do you turn off this effect in a UISplitViewController? Here is the code used to setup the split view and the app's main window: func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let winScene = (scene as? UIWindowScene) else { return } let primary = PrimaryViewController(style: .plain) let primaryNC = UINavigationController(rootViewController: primary) let detail = DetailViewController(style: .plain) let detailNC = UINavigationController(rootViewController: detail) let sv = UISplitViewController(style: .doubleColumn) sv.preferredDisplayMode = .oneBesideSecondary sv.preferredSplitBehavior = .tile sv.primaryBackgroundStyle = .none sv.displayModeButtonVisibility = .automatic sv.setViewController(primaryNC, for: .primary) sv.setViewController(detailNC, for: .secondary) let win = UIWindow(windowScene: winScene) win.rootViewController = sv win.makeKeyAndVisible() window = win } The PrimaryViewController and DetailViewController are simple UITableViewController subclasses that only add a few rows and section headers as needed.
4
1
123
1d
PDFKit Zoom Performance Issue with Many Annotations
Hello, I’m using PDFKit to display PDFs with a large number of annotations. However, when there are many annotations, I’m experiencing serious performance issues while zooming in/out with PDFView. • During pinch zoom, it seems like continuous re-rendering occurs. • Memory usage spikes dramatically while zooming, then drops back down repeatedly. • As a result, zooming feels laggy and not smooth. What I’d like to achieve is the following: 1. Prevent unnecessary re-rendering while zooming is in progress. 2. Trigger a single re-render only once the zoom gesture ends (e.g., in scrollViewDidEndZooming). 3. At the very least, avoid the memory spikes during zoom. Is there any way to control how annotations are re-drawn during zooming in PDFKit, or to throttle/debounce rendering so it happens only after the gesture completes? I’d really appreciate any advice from others who have encountered similar issues, or guidance from Apple on the recommended approach. Thanks in advance!
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
44
1d
iPadOS 26 - TableView auto scrolling bug
We are observing that for devices with iPadOS 26, table views within apps are unexpectedly auto scrolling. The issue can be reproduced as follows: The table view has enough cells to the point where not all cells can fit on the screen and the table view is scrollable User has scrolled to the bottom of the tableView and tableView.reloadData() is called. One of the following applies: The ViewController containing the tableView is embedded in a UINavigationController, and ViewController sets self.edgesForExtendedLayout = .bottom The ViewController containing the tableView is embedded in a UINavigationController, and UINavigationController sets navigationBar.isTranslucent = false The following constraints are applied to the tableView: tableView.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor).isActive = true tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true After thorough testing, we've found that the bug is only present in iPads with iPadOS 26. It does not show for iPhone devices or for iPads on iPadOS 18. We are hoping that this can be fixed as it is causing poor user experience. Full code needed to reproduce the issue: Use this willConnectTo function in SceneDelegate: func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = scene as? UIWindowScene else { return } window = UIWindow(windowScene: windowScene) let navigationControllerWithVC = UINavigationController(rootViewController: ViewController()) // ⚠️ CASE 1 - Comment out the .isTranslucent setter below, or set the value to true, and the scrolling issue will be gone, granted that the other issue-causing lines in ViewController.swift // are also commented. navigationControllerWithVC.navigationBar.isTranslucent = false window?.rootViewController = navigationControllerWithVC // Replace this line with window?.rootViewController = ViewController() to get rid of UINavigationController window?.makeKeyAndVisible() } Use this ViewController class that is referenced from the SceneDelegate willConnectTo function: import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { var tableView: UITableView! var safeArea: UILayoutGuide! var timer: Timer! override func viewDidLoad() { super.viewDidLoad() // ⚠️ CASE 2 - Uncomment the line below when this view is inside a UINavigationController to cause the scrolling issue. //self.edgesForExtendedLayout = .bottom tableView = UITableView() safeArea = view.layoutMarginsGuide setupTableView() timer = Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(fireTimer), userInfo: nil, repeats: true) } @objc public func fireTimer() { tableView.reloadData() print("Reloaded table") } func setupTableView() { tableView.delegate = self tableView.dataSource = self view.addSubview(tableView) tableView.translatesAutoresizingMaskIntoConstraints = false // ⚠️ CASE 3 - Replace view.topAnchor in the next line below with safeArea.topAnchor to see the scrolling issue, regardless if view is inside a UINavigationController. tableView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 40 } public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 50.0 } public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell() cell.textLabel?.text = indexPath.row == 39 ? "END" : "Row \(indexPath.row)" return cell } public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) } } For reproducing this on iPadOS 26 simulators, I can confirm that simulators under Xcode 26.0.1 (17A400) and Xcode 26.1 Beta (17B5025f) will show the issue. The issue is present in iPadOS 26 and iPadOS 26.1 beta. I've also submitted Apple Feedback for this (FB20357980) with all this code in a Xcode project.
3
0
186
1d
preferredImageDynamicRange is not marked as being available only for iOS 17 and above.
open var isAnimating: Bool { get } /// The preferred treatment to use for HDR images. By default the image view will defer to the value from its traitCollection. open var preferredImageDynamicRange: UIImage.DynamicRange /// The resolved treatment to use for HDR images. open var imageDynamicRange: UIImage.DynamicRange { get } This attribute is not marked as being applicable only in iOS 17+ versions. When viewing the UIImageView code in Xcode, the @available(iOS 17.0, *) annotation was not added, which resulted in successful compilation but caused a crash on iOS 16 devices.
3
0
72
1d
We can’t see Large Title on NavigationBar on iOS 26
Apps built with the iOS 26 beta SDK do not display largeTitle. When we built with iOS 18 SDK, it displayed correctly. The official reference shows that a property named largeTitle has been added since iOS 26 beta. However, setting this did not change the result. Does anyone know how to implement the property?
Topic: UI Frameworks SubTopic: UIKit
5
1
278
2d
UIScene based state restoration on tvOS not working
I can’t get UIScene-based state restoration to work on tvOS as it does on iOS. UISceneSession.stateRestorationActivity is always nil in UIWindowSceneDelegate.scene(_:willConnectTo:options:) despite UIWindowSceneDelegate.stateRestorationActivity(for:) being called in the previous lifecycle. The NSUserActivityType is correctly configured in the Info.plist. Has anyone encountered the same issue or knows how to get this to work? Sample Project https://github.com/antiraum/tvosSceneStateRestoration Feedback FB20451479
1
0
43
2d
Using UIDocumentViewController with UISplitViewController in Xcode 26
I created a UIKit Document-Based App in Xcode 26. When using UIDocumentViewController on its own, everything works fine. However, when I try to use it with UISplitViewController or add a Toolbar, I run into an issue: the Sidebar and Toolbar UI remain visible above the Document Browser. Older sample projects show a Document-Based App set up with UISplitViewController, but it seems like with the more recent recommended approach, UISplitViewController may no longer be supported. Is that correct? While I could give up on using a Toolbar, I’d really like to know if there’s still a way to use UISplitViewController together with UIDocumentViewController.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
12
2d
Image sizing in context menus on Tahoe via Catalyst
I've got a Catalyst app that exposes some custom context menu items via the buildMenu API. When it runs on Tahoe, there's some weirdness with how the images in the menu items are sized. See attached screenshot below. The three items on the bottom are using SF Symbols for their images, and the rest are using custom images from an asset catalog. Is this a bug in Tahoe 26.0? Or should I be resizing my images before giving them to UIAction? If the latter, what should the size be, and is this documented somewhere or available from an API?
0
1
64
2d
UIModernBarButton causing a lot of console constraint warning and eventual animation glitches
is there anything I can do about this? It's in a navigation controller, and I get a lot of these when I pop and push. eventually it causes glitches with zoom animations making for some really loopy zooms. I posted a movie to FB20439774. If there's anything I can do to fix it would be great. Unable to simultaneously satisfy constraints. ( "<NSAutoresizingMaskLayoutConstraint:0x600002149680 h=-&- v=-&- TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x106b0e700.minX == 0 (active, names: '|':TtGC5UIKit22UICorePlatformViewHostGVS_32PlatformViewRepresentableAdaptorVS_P10$186c5d1b020ButtonRepresentation:0x106b08ef0 )>", "<NSAutoresizingMaskLayoutConstraint:0x600002149590 h=-&- v=-&- H:[TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x106b0e700]-(0)-| (active, names: '|':TtGC5UIKit22UICorePlatformViewHostGVS_32PlatformViewRepresentableAdaptorVS_P10$186c5d1b020ButtonRepresentation:0x106b08ef0 )>", "<NSLayoutConstraint:0x600002142b20 _TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x106b0e700.width == _UIButtonBarButton:0x106b16ef0.width (active)>", "<NSLayoutConstraint:0x60000214a4e0 'UITemporaryLayoutWidth' TtGC5UIKit22UICorePlatformViewHostGVS_32PlatformViewRepresentableAdaptorVS_P10$186c5d1b020ButtonRepresentation:0x106b08ef0.width == 0 (active)>", "<NSLayoutConstraint:0x600002143200 'IB_Leading_Leading' H:|-(1)-[_UIModernBarButton:0x106b09810] (active, names: '|':_UIButtonBarButton:0x106b16ef0 )>", "<NSLayoutConstraint:0x6000021434d0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x106b09810]-(1)-| (active, names: '|':_UIButtonBarButton:0x106b16ef0 )>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000021434d0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x106b09810]-(1)-| (active, names: '|':_UIButtonBarButton:0x106b16ef0 )>
1
0
54
2d
UIStepper can't reach min/max value
When I build my project with Xcode 26 the following code makes the stepper decrement option disabled: stepper.stepValue = 0.5 stepper.value = 1.0 stepper.minimumValue = 0.7 stepper.maximumValue = 4.0 I think the reason for this is that the (value - stepValue) goes bellow the minimumValue. But on all iOS versions before iOS 26 this made the decrement option enabled and it clamped the value to the minimumValue. The same issue can be reproduced for the maximumValue. Does anyone else have the same issue? Do we need to adjust the stepValue based on the current value?
1
0
58
3d
iPadOS 26 - Status bar overlaps with navigation bar
Hello, I'm experiencing a navigation bar positioning issue with my UIKit iPad app on iPadOS 26 (23A340) using Xcode 26 (17A321). The navigation bar positions under the status bar initially, and after orientation changes to landscape, it positions incorrectly below its expected location. This occurs on both real device (iPad mini A17 Pro) and simulator. My app uses UIKit + Storyboard with a Root Navigation Controller. A stack overflow post has reproduce the bug event if it's not in the same configuration: https://stackoverflow.com/questions/79752945/xcode-26-beta-6-ipados-26-statusbar-overlaps-with-navigationbar-after-presen I have checked all safe areas and tried changing some constraints, but nothing works. Have you encountered this bug before, or do you need additional information to investigate this issue?
6
1
230
3d
hidesBottomBarWhenPushed is bugged on iOS 26
I am using a common UI pattern: UITabBarController as window root, each tab with a separate UINavigationController stack. I want the (bottom!) tab bar to be only visible when the user is at the root of the app and hide it when a detail page is opened. To do that, I used hidesBottomBarWhenPushed on any view controller that would be pushed on my navigation stacks and that worked fine in the past. But with iOS 26, I am seeing several issues: On iOS where when the bottom tab bar is used, when in a details page and navigating back, the tab bar becomes fully visible immediately instead of slowly animating in as it has been in the past. This is particular visible and annoying when using the "swipe to go back" gesture On iPad, the situation is even worse: On iPadOS 18, the tab bar appeared in the navigation controller's navigation bar - no matter if hidesBottomBarWhenPushed was set or not - fine. But now, with iPadOS 26, this top tab bar disappears when a child is pushed. Not only that, it disappears abruptly, without animation, and the Liquid Glass effect on the UIBarButtonItems is broken as well. There is no transition whatsoever, buttons are simply replaced with the new UIBarButtonItems of the pushed view controller once it became fully visible. It gets even worse when swipe-back navigating on iPadOS: As soon as the back transition starts, the tab bar becomes visible again (without animation), covering the title (view) of the UINavigationController. If the swipe-back transition is not completed the tab bar suddenly stays visible When the swipe-back transition is interrupted close to the end of the transition and it goes back to the pushed view controller, the top UIBarButtonItems are showing a visual glitch where the content (text or icon) stays on the area where the tab bar is, while their container (the glass effect) are on the vertically aligned to the title view. I am surprised that I have not found any similar reports of these problems, so I am wondering if I am doing anything wrong or using hidesBottomBarWhenPushed simply isn't recommended or supported any more.
0
0
65
4d
Why the backgroud color changes when I draw on the canvas?
override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .gray view.insetsLayoutMarginsFromSafeArea = false setupCanvasView() setupToolPicker() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) // 确保画布成为第一响应者以显示工具栏 canvasView.becomeFirstResponder() } func setupCanvasView() { canvasView.frame = view.bounds canvasView.delegate = self canvasView.insetsLayoutMarginsFromSafeArea = false // 设置画布属性以支持绘画 canvasView.alwaysBounceVertical = true canvasView.alwaysBounceHorizontal = true canvasView.isScrollEnabled = true canvasView.showsVerticalScrollIndicator = true canvasView.showsHorizontalScrollIndicator = true canvasView.contentSize = CGSize(width: 500,height: 500) // 启用绘画功能 canvasView.drawingPolicy = .anyInput // 支持手指和 Apple Pencil view.addSubview(canvasView) } AS THE CODE ABOVE,WHEN I DRAW ON THE CANVAS,THE BACKGROUND CHANGE ITS COLOR TO WHITE, how to fix it? !
Topic: UI Frameworks SubTopic: UIKit
0
0
16
4d