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

iOS26: `UITabAccessory` is both deeply inflexible and inconsistent
On iPhones: It will force the full width of the accessory view irrespective of its content Placing a view that manages its own glass – like a collection of individual glassy buttons – means that the full-width container is still encased in an outer layer of glass. There is no way to remove the outer glass layer, and it's not exposed as a property of a visual effect view, of the parent _UITabAccessoryContainer, or its parent _UITabBarContainerView. On iPads: Infuriatingly, it behaves completely different in regular width layouts. Suddenly, it doesn't draw a full width glass container around the content and starts respecting the supplied view's layout. A collection of glassy buttons starts working as intended. This all falls apart in compact layouts and starts behaving like an iPhone. The lack of configuration on this API is deeply unusual. More unusual is that there's no layout guide or similar for us to hook into to supply our own bottom accessory behavior.
Topic: UI Frameworks SubTopic: UIKit
0
0
26
4h
UIBarButtonItems do not respect tintColor property set on a UINavigationItem
In iOS and iPadOS 26 beta 9 (and previous batas), setting the tintColor property on a navigation bar does not tint bar button items. The text and images are always black in the following cases: Buttons displaying only text (initWithTitle:) Buttons displaying only a symbol (initWithImage:) Buttons displaying system items, ie., UIBarButtonSystemItemCancel. Nav bar title The tintColor seems to be respected for: Selected-state background for buttons configured with changesSelectionAsPrimaryAction. To reproduce, Create a UINavigationController, Add bar button items to its navigation item, Set a tint color as in the following statement: self.navigationController.navigationBar.tintColor = [UIColor redColor]; Then note that the bar button items are black rather than red as expected. I have filed a feedback: FB19980265.
Topic: UI Frameworks SubTopic: UIKit
0
0
67
9h
No dynamic guide available for the underlying `_UITabBarPlatterView`?
The new UITabBarController APIs are great! But they leave a lot to be desired. For example, let's say I want a bottom accessory – one simple enough that it could be a UIBarButtonItem. The UITabAccessoryAPI only takes UIViews but passing a simple UIVIew or UIButton will create a new problem: now the view is stretched to be huge instead of a tiny little image-button. New approach: Show it on screen as a contextual overlay modal thing. I can do that, no problem. New problem: It won't animate down when the tab bar minimizes, like the bottom accessory does; there is no layout guide exposed that allows us to hook into this. I'd really rather not reverse engineer to grab the platter when the state is minimized and set some funky layout constraints to adapt to it, determine that it can fit (a bit irrelevant in this instance, since it's a single button), and animate into place as the tab bar animates. I know there's a new contentLayoutGuide, but it doesn't seem there's anything like what I'm looking for here. I basically just want a tab accessory view, but I don't want to commit to it being so huge. And what happens if I want multiple views here? Suddenly, this opens up the toolbar, but… having a toolbar and a tab bar in the same app is an exercise in frustration, since the tab bar will cover up the toolbar. In a different environment, I may have gone ahead and just wrapped my own UITabBar, as Steve Troughton-Smith does via his Mastodon post (can't link directly). That presents another host of issues though: iPad behavior goes out the window. I'd probably still have to dig into private APIs to get a magic pocket effect that works the same as the UITabBarController's! UIScrollEdgeElementContainerInteraction doesn't behave exactly the same as the interaction added to the tab bar by the tab bar controller. Is there any such API for this? What possible reason could there be for keeping these APIs private?
Topic: UI Frameworks SubTopic: UIKit
0
0
62
9h
debugDescription missing from UIToolbar
Starting from iOS 26 simulator (beta 7), I could not see any debugDescription from UIToolbar. The Accessibility Inspector tool could not see anything beneath the toolbar even if we can see elements like static texts and buttons on the simulator. When the same app is run on an iOS 18.2 simulator, the debugDescription for elements under a UIToolbar is available. Is the absence of debugDescription for UIToolbar a bug?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
57
11h
Adaptation of UIScrollEdgeElementContainerInteraction in UITableView
When I set up UIScrollEdgeElementContainerInteraction for a UITableView in iOS 26 like this: let interaction = UIScrollEdgeElementContainerInteraction() interaction.scrollView = tableView interaction.edge = .top viewHeader.addInteraction(interaction) the section header remains displayed above the gradient glass effect, but the cells do not exhibit this issue. Visually, the cells appear beneath the glass layer, while the header appears above the glass layer—even though, in reality, both the header and the cells are positioned below the glass layer in the view hierarchy.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
35
20h
PressBegan() invoked twice when pressing Command + key on UITextView/UITextField
I am observing an unexpected behavior with external keyboard input on iOS. When I press Command + key (e.g., ⌘ + J) while a UITextView is focused, the system invokes pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) twice: -> Once with the key press event without any modifier flags. -> A second time with the same key event but including the Command modifier flag. This behavior is checked on an iPad with an external keyboard. Additionally, I noticed that textView(_:shouldChangeTextIn:replacementText:) is not invoked in this case, even if I call super.pressesBegan for event propagation. Questions: Is it expected that pressesBegan fires twice for a Command + key combination? If so, what is the recommended way to distinguish between these two invocations? Should the UITextView delegate methods (like shouldChangeTextIn) be triggered for such key combinations, or is this by design?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
74
1d
iOS 26 Beta 9 dark/light behaviour over custom UIViews in UITabBarController and CPMapTemplate
I have an app where the user can choose if the dark / light mode is enabled automatically during the night / day (dusk and dawn times are calculated according to to the date and location of the user). I also have an UITabBarController, with two tabs which have a GMSMapView (Google Map View from their SDK), and three tabs with UITableViews. I have noticed that when the automatic change of dark / light mode is performed from dark to light mode, and the user is in a tab with GMSMapView, the tabBar does not change to light model, it remains in dark mode. I perform the switch by setting the self.window.overrideUserInterfaceStyle of the UIWindow of the UIScene. All the views change to light mode, including the navigation bar, but not the tab bar. If I move between the tabs with GMSMapView, the tabBar stays in dark mode. As soon as I move to a tab which contains a UITableView, the tabBar switches to light mode. If the switch to light mode is performed while the user is in tab with the UITableViews, the tabBar switches to light mode immediately, as expected. When moving to the tabs with the GMSMapViews, the tabBar stays in light mode, also as expected. I have also noticed the same problem in CarPlay, in CPMapTemplate (with a UIViewController whose view is GMSMapView), in the buttons with are set with the property “mapButtons”, and with the panning buttons. When the switch from dark mode to light mode is performed by setting the self.window.overrideUserInterfaceStyle of the UIWindow of CarPlay scene, the mapButtons keeps the glyphs in white, and set the background of the buttons to almost white, so the glyphs are barely visible unless you put png images on them instead of SF Symbols. With the panning buttons there is not workaround, since you cannot set custom images for the panning buttons. This happens even if the panning buttons are not being displayed when the switch is performed to light mode, and you enable them later. Is this a bug? Why does this only happen with view over GMSMapView (Google Maps view for a map from their SDK)? Can you think of any viable workaround? Thank you.
2
0
143
1d
iPadOS: remove system actions from Menu Bar
Hi, I am setting up the iPadOS26 Menu Bar, and it comes with some existing menu items that don't make sense for my app. For example, under "File" menu, there are options for New Window, Duplicate, Move, Rename and Export that I would like to remove (which keeping the Close Window option). What's the best way to do this?
Topic: UI Frameworks SubTopic: UIKit
3
0
116
2d
iPadOS keyboard formatting options
Hi, When I have a UITextView displayed on screen and in focus, the iPad keyboard shows buttons to Bold, Italics and Underline text (since it supports attributed text), and also a 'formatting' button that allows the user to change the font, color and size of the text, as well as justify text and add numbered lists and bullet points. Is there any way to disable or remove this 'formatting' button? My app doesn't support saving these options (other than bold, italics and underline), so it confuses users to see this option. Thanks.
Topic: UI Frameworks SubTopic: UIKit
0
0
99
2d
Custom Keyboard help
import UIKit class KeyboardViewController: UIInputViewController { // MARK: - Properties private var keyboardView: KeyboardView! private var heightConstraint: NSLayoutConstraint! private var hasInitialLayout = false // 存储系统键盘高度和动画参数 private var systemKeyboardHeight: CGFloat = 300 private var keyboardAnimationDuration: Double = 0.25 private var keyboardAnimationCurve: UIView.AnimationOptions = .curveEaseInOut // MARK: - Lifecycle override func viewDidLoad() { super.viewDidLoad() setupKeyboard() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) // 在视图显示前更新键盘高度,避免闪动 if !hasInitialLayout { hasInitialLayout = true } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } // MARK: - Setup private func setupKeyboard() { // 创建键盘视图 keyboardView = KeyboardView() keyboardView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(keyboardView) // 设置约束 - 确保键盘贴紧屏幕底部 NSLayoutConstraint.activate([ keyboardView.leftAnchor.constraint(equalTo: view.leftAnchor), keyboardView.rightAnchor.constraint(equalTo: view.rightAnchor), keyboardView.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) // 设置初始高度约束(使用系统键盘高度或默认值) let initialHeight = systemKeyboardHeight heightConstraint = keyboardView.heightAnchor.constraint(equalToConstant: initialHeight) heightConstraint.isActive = true } // MARK: - Layout Events override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() } override func viewSafeAreaInsetsDidChange() { super.viewSafeAreaInsetsDidChange() } // MARK: - 键盘高度请求 // 这个方法可以确保键盘扩展报告正确的高度给系统 override func updateViewConstraints() { super.updateViewConstraints() // 确保我们的高度约束是最新的 if heightConstraint == nil { let height = systemKeyboardHeight &gt; 0 ? systemKeyboardHeight : 216 heightConstraint = NSLayoutConstraint( item: self.view!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: height ) heightConstraint.priority = UILayoutPriority(999) view.addConstraint(heightConstraint) } else { let height = systemKeyboardHeight &gt; 0 ? systemKeyboardHeight : 216 heightConstraint.constant = height } } } // MARK: - Keyboard View Implementation class KeyboardView: UIView { private var keysContainer: UIStackView! override init(frame: CGRect) { super.init(frame: frame) setupView() } required init?(coder: NSCoder) { super.init(coder: coder) setupView() } private func setupView() { backgroundColor = UIColor(red: 0.82, green: 0.84, blue: 0.86, alpha: 1.0) // 创建按键容器 keysContainer = UIStackView() keysContainer.axis = .vertical keysContainer.distribution = .fillEqually keysContainer.spacing = 8 keysContainer.translatesAutoresizingMaskIntoConstraints = false addSubview(keysContainer) // 添加约束 - 确保内容在安全区域内 NSLayoutConstraint.activate([ keysContainer.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 8), keysContainer.leftAnchor.constraint(equalTo: safeAreaLayoutGuide.leftAnchor, constant: 8), keysContainer.rightAnchor.constraint(equalTo: safeAreaLayoutGuide.rightAnchor, constant: -8), keysContainer.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -8) ]) // 添加键盘行 } }
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
36
2d
Navigation title not visible in SplitViewController in macCatalyst on iOS 26
We are using a column style split view controller as root view of our app and in iOS26 the navigation titles of primary and supplementary view controllers are not visible and secondary view controller title is displayed in supplementary column. Looks the split view hidden all the child view controllers title and shown the secondary view title as global in macCatlayst. The right and left barbutton items are showing properly for individual view controllers. Facing this weird issue in iOS26 betas. The secondary navigation title also visible only when WindowScene,titlebar.titleVisibility is not hidden. Kindly suggest the fix for this issue as we can't use the secondary view navigation title for showing supplementary view's data. The issue not arises in old style split views or when the split view embedded in another splitView. Refer the sample code and attachment here let splitView = UISplitViewController(style: .tripleColumn) splitView.preferredDisplayMode = .twoBesideSecondary splitView.setViewController(SplitViewChildVc(title: "Primary"), for: .primary) splitView.setViewController(SplitViewChildVc(title: "Supplementary"), for: .supplementary) splitView.setViewController(SplitViewChildVc(title: "Secondary"), for: .secondary) class SplitViewChildVc: UIViewController { let viewTitle: String init(title: String = "Default") { self.viewTitle = title super.init(nibName: nil, bundle: nil) } override func viewDidLoad() { super.viewDidLoad() self.title = viewTitle self.navigationItem.title = viewTitle if #available(iOS 26.0, *) { navigationItem.subtitle = "Subtitle" } let leftbutton = UIBarButtonItem(barButtonSystemItem: .cancel, target: nil, action: nil) navigationItem.leftBarButtonItem = leftbutton let rightbutton = UIBarButtonItem(barButtonSystemItem: .add, target: nil, action: nil) navigationItem.rightBarButtonItem = rightbutton } }
0
0
166
3d
UIBarButtonItem Doesn't Reset the Badge
Hello, I hope you're all doing well! I'm currently working on integrating new iOS 26 features into my app, and so far, the process has been really exciting. However, I've encountered an issue when updating the badge of a UIBarButtonItem, and I’m hoping to get some insights or suggestions. The app has two UIViewController instances in the navigation stack, each containing a UIBarButtonItem. On the first controller, the badge is set to 1, and on the second, the badge is set to 2. In the second controller, there is a "Reset" button that sets the badge of the second controller to nil. However, when I tap the "Reset" button, instead of setting the badge to nil, it sets the value to 1. I would appreciate any ideas or suggestions on how to solve this problem. Maybe I am using the badge API incorrectly. Thank you! class ViewController: UIViewController { var cartButtonItem: UIBarButtonItem! override func viewDidLoad() { super.viewDidLoad() configureNavigationItem() } func configureNavigationItem() { cartButtonItem = UIBarButtonItem(image: UIImage(resource: .cartNavBar), style: .plain, target: self, action: #selector(showCartTab)) cartButtonItem.tintColor = UIColor.systemBlue cartButtonItem.badge = .count(1) navigationItem.rightBarButtonItem = cartButtonItem } @objc func showCartTab() { // Add second view controller in navigation stack performSegue(withIdentifier: "Cart", sender: nil) } } class CartViewController: UIViewController { var cartButtonItem: UIBarButtonItem! override func viewDidLoad() { super.viewDidLoad() configureNavigationItem() } func configureNavigationItem() { cartButtonItem = UIBarButtonItem(image: UIImage(resource: .cartNavBar), style: .plain, target: nil, action: nil) cartButtonItem.tintColor = UIColor.systemBlue cartButtonItem.badge = .count(2) navigationItem.rightBarButtonItem = cartButtonItem } func updateBadge() { cartButtonItem.badge = nil } @IBAction func resetButtonPressed(_ sender: Any) { updateBadge() } }
0
0
57
3d
How to access launchOptions in SceneDelegate?
Previously, when using AppDelegate, I was able to check the app’s launch options (launchOptions) to determine cases such as: Location updates (UIApplication.LaunchOptionsKey.location) Background push notifications (UIApplication.LaunchOptionsKey.remoteNotification) However, after migrating to the SceneDelegate approach, launchOptions is no longer available — it always returns nil. In my app, I need to branch the code depending on the launch options, but I can’t find a way to achieve this in the SceneDelegate environment. 👉 Is there a way to access launch options in SceneDelegate, similar to how it worked in AppDelegate? Or, if that’s no longer possible, what would be the proper alternative approach? Any guidance would be greatly appreciated.
2
0
95
4d
UIMenuBuilder - some menus refuse customization
I'm trying to customize the menu in my iPad app for iOS 26, since most of the default menu options aren't relevant to my app. Fortunately, I already have the code for this from my Mac Catalyst implementation. However, the functionality to replace menus with new sets of options has no effect on some menus on iOS. For example, updating the Format menu works fine on Mac Catalyst and iOS 26: override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) let transposeUpItem = UIKeyCommand(title: NSLocalizedString("TRANSPOSE_UP"), image: nil, action: #selector(TransposeToolbar.transposeUp(_:)), input: "=", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let transposeDownItem = UIKeyCommand(title: NSLocalizedString("TRANSPOSE_DOWN"), image: nil, action: #selector(TransposeToolbar.transposeDown(_:)), input: "-", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let transposeGroup = UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(rawValue: "transposeGroup"), options: UIMenu.Options.displayInline, children: [transposeUpItem, transposeDownItem]) let boldItem = UIKeyCommand(title: NSLocalizedString("BOLD"), image: nil, action: #selector(FormatToolbar.bold), input: "b", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let italicItem = UIKeyCommand(title: NSLocalizedString("ITALIC"), image: nil, action: #selector(FormatToolbar.italic), input: "i", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let underlineItem = UIKeyCommand(title: NSLocalizedString("UNDERLINE"), image: nil, action: #selector(FormatToolbar.underline), input: "u", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let colorItem = UIKeyCommand(title: NSLocalizedString("COLOR"), image: nil, action: #selector(FormatToolbar.repeatColor), input: "c", modifierFlags: [.command, .alternate], propertyList: nil, alternates: []) let clearItem = UIKeyCommand(title: NSLocalizedString("CLEAR_FORMATTING"), image: nil, action: #selector(FormatToolbar.clear), input: "x", modifierFlags: [.command, .alternate], propertyList: nil, alternates: []) let formatGroup = UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(rawValue: "formatGroup"), options: UIMenu.Options.displayInline, children: [boldItem, italicItem, underlineItem, colorItem, clearItem]) let markerItem = UIKeyCommand(title: NSLocalizedString("ADD_A_MARKER"), image: nil, action: #selector(FormatToolbar.marker), input: "m", modifierFlags: [.command, .alternate], propertyList: nil, alternates: []) let markerGroup = UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(rawValue: "markerGroup"), options: UIMenu.Options.displayInline, children: [markerItem]) var formatMenu = builder.menu(for: .format) var formatItems = [transposeGroup, formatGroup, markerGroup] formatMenu = formatMenu?.replacingChildren(formatItems) if let formatMenu = formatMenu { builder.replace(menu: .format, with: formatMenu) } } The same approach for the View menu works fine on Mac Catalyst, but has no effect on iOS 26. I see the same View menu options as before: override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) let helpItem = UIKeyCommand(title: NSLocalizedString("HELP"), image: nil, action: #selector(utilityHelp), input: "1", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let actionItemsItem = UIKeyCommand(title: NSLocalizedString("ACTION_ITEMS"), image: nil, action: #selector(utilityActionItems), input: "2", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let remoteControlItem = UIKeyCommand(title: NSLocalizedString("APP_CONTROL_STATUS"), image: nil, action: #selector(utilityRemoteControl), input: "3", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let midiItem = UIKeyCommand(title: NSLocalizedString("MIDI_STATUS"), image: nil, action: #selector(utilityMidi), input: "4", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let linkingItem = UIKeyCommand(title: NSLocalizedString("LIVE_SHARING_STATUS"), image: nil, action: #selector(utilityLinking), input: "5", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let syncItem = UIKeyCommand(title: NSLocalizedString("SYNCHRONIZATION"), image: nil, action: #selector(utilitySync), input: "6", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let settingsItem = UIKeyCommand(title: NSLocalizedString("SETTINGS"), image: nil, action: #selector(utilitySettings), input: "7", modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let utilityGroup = UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(rawValue: "utilityGroup"), options: UIMenu.Options.displayInline, children: [helpItem, actionItemsItem, remoteControlItem, midiItem, linkingItem, syncItem, settingsItem]) let backItem = UIKeyCommand(title: NSLocalizedString("BUTTON_BACK"), image: nil, action: #selector(navigateBack), input: UIKeyCommand.inputLeftArrow, modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let mainMenuItem = UIKeyCommand(title: NSLocalizedString("MAIN_MENU"), image: nil, action: #selector(navigateMain), input: UIKeyCommand.inputLeftArrow, modifierFlags: [.command, .alternate], propertyList: nil, alternates: []) let navigateGroup = UIMenu(title: "", image: nil, identifier: UIMenu.Identifier(rawValue: "navigateGroup"), options: UIMenu.Options.displayInline, children: [backItem, mainMenuItem]) var viewMenu = builder.menu(for: .view) var viewItems = [utilityGroup, navigateGroup] viewMenu = viewMenu?.replacingChildren(viewItems) if let viewMenu = viewMenu { builder.replace(menu: .view, with: viewMenu) } } I tried a couple other approaches, but they also did nothing: var viewMenu = builder.menu(for: .view) var viewItems = [utilityGroup, navigateGroup] builder.replaceChildren(ofMenu: .view, from: { oldChildren in viewItems }) Also: viewMenu = UIMenu(title: NSLocalizedString("VIEW"), image: nil, identifier: .view, options: UIMenu.Options.displayInline, children: viewItems) if let viewMenu = viewMenu { builder.replace(menu: .view, with: viewMenu) } Does anyone know how to make this work for the View menu? It's frustrating that Apple added all these default options, without an easy way to remove options that aren't relevant.
Topic: UI Frameworks SubTopic: UIKit
3
0
290
6d
Wrong tint on CPMapButton in iOS 26
In my CarPlay app my CPMapButton with system images have the wrong tint when the CarPlay appearance is set to "Always Dark". Here is what it looks like. When I change the system appearance to "Automatic" the buttons look fine. Has anyone encountered this or know how to fix it?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
82
6d
iOS26 UISearchbar and UISearchController cancellation issues
Is the Cancel button intentionally removed from UISearchBar (right side)? Even when using searchController with navigationItem also. showsCancelButton = true doesn’t display the cancel button. Also: When tapping the clear ("x") button inside the search field, the search is getting canceled, and searchBarCancelButtonClicked(_:) is triggered (Generally it should only clear text, not cancel search). If the search text is empty and I tap outside the search bar, the search is canceled. Also when I have tableview in my controller(like recent searches) below search bar and if I try to tap when editing started, action is not triggered(verified in sample too). Just cancellation is happening. In a split view controller, if the search is on the right side and I try to open the side panel, the search also gets canceled. Are these behaviors intentional changes, beta issues, or are we missing something in implementation?
5
0
172
6d
Clarification on the purpose of return value in textFieldShouldReturn
I’m trying to understand the exact role of the return value in the UITextFieldDelegate method textFieldShouldReturn(_:). From my experiments in Xcode, I observed: Returning true vs false does not seem to cause any visible difference (e.g., the keyboard does not automatically dismiss either way). I know that in shouldChangeCharactersIn returning true allows the system to insert the character, and returning false prevents it. That’s clear. For textFieldShouldReturn, my current understanding is that returning true means “let the OS handle the Return press,” and returning false means “I’ll handle it myself.” My confusion: what is it that the OS actually does when it “handles” the Return press? Does UIKit do anything beyond calling this delegate method? If the system is supposed to dismiss the keyboard when returning true, why doesn’t it happen automatically? I’d appreciate clarification on the expected use of this return value — specifically, what default behavior the system performs (if any) when we return true. Thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
69
6d
EXC_BAD_ACCESS (SIGSEGV) crash observed in NSDateFormatter APIs
(NSString*)getClienttime { NSDate* currentDate = [NSDate date]; NSDateFormatter* dateformatter = [[NSDateFormatter alloc] init]; dateformatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:8*3600]; dateformatter.locale= [NSLocale systemLocale]; [dateformatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; return [dateformatter stringFromDate:currentDate]?:@""; } the info of crash 1 libicucore.A.dylib icu::UnicodeString::copyFrom(icu::UnicodeString const&, signed char) (in libicucore.A.dylib) + 36 2 libicucore.A.dylib icu::DecimalFormatSymbols::operator=(icu::DecimalFormatSymbols const&) (in libicucore.A.dylib) + 64 3 libicucore.A.dylib icu::DecimalFormatSymbols::operator=(icu::DecimalFormatSymbols const&) (in libicucore.A.dylib) + 64 4 libicucore.A.dylib icu::DecimalFormat::DecimalFormat(icu::DecimalFormat const&) (in libicucore.A.dylib) + 188 5 libicucore.A.dylib icu::DecimalFormat::clone() const (in libicucore.A.dylib) + 48 6 libicucore.A.dylib icu::NumberFormat::createInstance(icu::Locale const&, UNumberFormatStyle, UErrorCode&) (in libicucore.A.dylib) + 188 7 libicucore.A.dylib icu::SimpleDateFormat::initialize(icu::Locale const&, UErrorCode&) (in libicucore.A.dylib) + 580 8 libicucore.A.dylib icu::SimpleDateFormat::SimpleDateFormat(icu::Locale const&, UErrorCode&) (in libicucore.A.dylib) + 332 9 libicucore.A.dylib icu::DateFormat::create(icu::DateFormat::EStyle, icu::DateFormat::EStyle, icu::Locale const&) (in libicucore.A.dylib) + 264 10 libicucore.A.dylib udat_open (in libicucore.A.dylib) + 396 11 CoreFoundation __cficu_udat_open (in CoreFoundation) + 72 12 CoreFoundation __ResetUDateFormat (in CoreFoundation) + 508 13 CoreFoundation __CreateCFDateFormatter (in CoreFoundation) + 324 14 Foundation -[NSDateFormatter _regenerateFormatter] (in Foundation) + 204 15 Foundation -[NSDateFormatter stringForObjectValue:] (in Foundation) + 104 16 ABC +[JMAContext getClienttime] (in DadaStaff) (JMAContext.m:73)
Topic: UI Frameworks SubTopic: UIKit
0
0
86
1w