In our application we have one banner via UIStackview which has one UIBotton & UILabel in horizontal stackview.
In UI is working fine in all the iOS Version & devices but it is creating issue for iOS 14.2 iPhone 6s.
We have verified the same in iOS 15.3.1 iPhone 6s, its is working fine.
We are attaching 2 screenshot:
Our Storybaord specific ui component.
The distorted UI of iOS 14.2 iPhone 6s.
Kindly update us on priority as end customer is facing issue.
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We maintain a device driver for macOS. This consists of a bunch of components including a Launch Agent, a (Cocoa/AppKit) status bar item app, and a "main" windowed UI app. These all communicate with each other via XPC using the "low level" XPC APIs (libxpc). The launch agent registers a named Mach XPC service, and the two apps connect to it when they launch.
Last year, we had an overhaul of the main UI app as we wanted to add a bunch of features. In the process we decided to switch it from Cocoa/AppKit to Mac Catalyst/UIKit as we were also contemplating porting the driver to iPadOS in future; plus, UIKit is a little simpler and I'm not a great UI programmer, so any simplification is welcome.
This has worked OK so far, but in our attempt to upgrade our build toolchain from Xcode 15.2 to Xcode 15.4 we found that the Catalyst app would no longer build. Apparently the xpc_connection_create_mach_service() and xpc_connection_set_peer_code_signing_requirement() functions are no longer available as of the Mac Catalyst SDK included with Xcode 15.3. This makes it impossible for the app to connect to the launch agent's XPC service.
A few things to note:
These functions were never deprecated, so we did not have their impending removal on our radar.
It seems they actually used to be available in the iOS SDK and were removed from that, so Mac Catalyst is effectively collateral damage. I don't think these would ever have been usable in apps on the iOS App Store, so perhaps they were removed from the iOS SDK ahead of support for notarised iOS app distribution.
So it looks like they might have been removed from Mac Catalyst SDK by accident? I therefore filed a bug about this - FB13929309 - about 6 weeks ago. Reinstating the functions for Mac Catalyst would seem like a very straightforward fix, but I've not had a hint of feedback on the report.
I guess my forum question comes down to this: Is Mac Catalyst considered a platform for building macOS apps in its own right? Or are we "holding it wrong" and should we only treat it as a way of tweaking Mac ports of iOS/iPad-first apps? Should we expect APIs to disappear from the Mac Catalyst SDK with zero notice?
We can still build with Xcode 15.2 for the moment, and the app built this way runs fine up to and including the macOS 15 beta. But thanks to the limited forward and backward compatibility schedule for Xcode we can't stay on old Xcode for long We're also planning to make some feature changes to the app in the near future, and I don't want to be investing in an app built on a platform with no future. I'd rather port the app back to Cocoa/AppKit before adding features if that's the case.
iOS 18 introduced the elevated tab bar for iPad devices. However, the tint color for UITabBar items is not changing. Adjusting the barTintColor and tintColor properties of the tab bar items does not seem to have any effect.
On iOS17, when the device is on Dark mode, the background of the Edit Mode in QLPreviewController has white color, instead of dark color. (like in the iOS18 betas)
We support both iOS17 and iOS18 and we want our users to have a consistent experience, so we think this should be aligned in iOS17, as it's currently working in iOS18 betas.
Steps:
Set the device to Dark Mode.
Present a QLPreviewController and preview an image.
Enable Markup/Edit mode.
Observe the image background
Actual Result: The background is in white color.
Expected Result: The background is in dark color. (Just like in iOS18 betas)
Xcode 16b3, All iPhones.
I'm getting a crash on iOS 14.4.1 and other older versions when entering text into a UITextBox in my game. I tried disabling auto correct on the field and it seemed to make the issue occur less often, but it is not solving 100% of the cases. Does anyone know how to prevent this exception and turn off auto complete on the text field entirely? None of the call stack is actually my code other than main.
Update: I am already setting self.textInput.autocorrectionType = UITextAutocorrectionTypeNo;
0 CoreFoundation +0x125868 ___exceptionPreprocess
1 libobjc.A.dylib +0x6c4c _objc_exception_throw
2 CoreFoundation +0x1e4a0 +[NSException raise:format:]
3 QuartzCore +0x16adb0 CA::Layer::set_position(CA::Vec2<double> const&, bool)
4 QuartzCore +0x16ace0 -[CALayer setPosition:]
5 QuartzCore +0x16a7b8 -[CALayer setFrame:]
6 UIKitCore +0x10f8184 -[UIView(Geometry) setFrame:]
7 UIKitCore +0x9b7038 -[UIKeyboardImpl updateAutocorrectPrompt:correctionRects:]
8 UIKitCore +0x9b6a54 -[UIKeyboardImpl updateAutocorrectPrompt:executionContext:]
9 UIKitCore +0x9d5274 ___56-[UIKeyboardScheduledTask handleDeferredTimerFiredEvent]_block_invoke
10 UIKitCore +0x9d57d8 -[UIKeyboardTaskEntry execute:]
11 UIKitCore +0x9d420c -[UIKeyboardTaskQueue continueExecutionOnMainThread]
12 UIKitCore +0x9d518c -[UIKeyboardScheduledTask handleDeferredTimerFiredEvent]
13 CoreFoundation +0x12a8f0 ___invoking___
14 CoreFoundation +0x1df4 -[NSInvocation invoke]
15 UIKitCore +0xfa5778 -[_UIActionWhenIdle invoke]
16 CoreFoundation +0xa0354 ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
17 CoreFoundation +0x9a5c0 ___CFRunLoopDoObservers
18 CoreFoundation +0x9ab70 ___CFRunLoopRun
19 CoreFoundation +0x9a218 _CFRunLoopRunSpecific
20 GraphicsServices +0x3780 _GSEventRunModal
21 UIKitCore +0xbc8ee4 -[UIApplication _run]
22 UIKitCore +0xbce758 _UIApplicationMain
23 Wizard-of-Oz +0x20f8268 main (main.mm:38:19)
24 libdyld.dylib +0x16ac _start
I have a UIImageView and a bottom container view inside a UIScrollView.
I set the scrollView's contentInsetAdjustmentBehavior to .never because I want the scrollView's content to anchor to top of the view, such that the content of the scroll view, in this case the imageView, shows inside the top safe area.
The ImageView currently shows all the way to the top. However, the problem is that when the user scrolls down, and the bottomContainer view meets the top Safe Area, the top of the bottomContainer view stretches. The bottom container has all its constraint set for its subviews, from top to bottom. I don't understand why the bottomContainer view would stretch vertically.
The constraint for these views are as follows:
// adds view as subview with `translatesAutoResizingMasksIntoConstraints = false
self.view.add(subviews: mainScrollView)
NSLayoutConstraint.activate([
self.mainScrollView.topAnchor.constraint(equalTo: self.view.topAnchor),
self.mainScrollView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
self.mainScrollView.leftAnchor.constraint(equalTo: self.view.leftAnchor),
self.mainScrollView.rightAnchor.constraint(equalTo: self.view.rightAnchor),
self.mainScrollView.contentLayoutGuide.widthAnchor.constraint(equalTo: self.view.widthAnchor)
])
// adds views as subviews with `translatesAutoResizingMasksIntoConstraints = false
self.mainScrollView.add(subviews: [self.profileImageView, self.bottomContainer])
// adds constraints to caller view's edges on axis
self.mainScrollView.make(views: [self.profileImageView, self.bottomContainer], flushAlongAxes: [.horizontal])
// Adds VLF constraints to views on the callers edges
self.mainScrollView.addConstraints(
withVisualFormat: "V:|[profileView(\(self.profileViewHeight))]-(-10)-[bottomContainer]-15-|",
views: ["profileView": self.profileImageView, "bottomContainer": self.bottomContainer])
I will attach a some screenshots to clarify what is happening:
Here is how it is supposed to look:
Here is how it stretches as the bottomContainer scrolls under the SafeArea:
How do I prevent the bottomContainer from stretching when it scrolls under the top safe area?
I'm creating a Netflix like app on tvOS, here is my compositional layout that I use with my collectionView.
private func createLayout() -> UICollectionViewCompositionalLayout {
return UICollectionViewCompositionalLayout { (section, _) -> NSCollectionLayoutSection? in
// item
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10)
// group
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1/5),
heightDimension: .estimated(350))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
// section
let section = NSCollectionLayoutSection(group: group)
section.orthogonalScrollingBehavior = .groupPaging
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(UIFont(name: "MyFont", size: 36)!.lineHeight))
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: "SectionHeader",
alignment: .top)
section.boundarySupplementaryItems = [sectionHeader]
section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 20, bottom: 30, trailing: 0)
return section
}
}
So:
My collection view is composed by several row (that are the sections).
Each section is composed by groups containing 1 item each.
Each section can be scrolled horizontally.
And you can scroll vertically to move from a section to an other.
I'm expecting to have the following behavior when scrolling: Horizontal scrolling:
Before focus shifts
--------------------------
| vA vB vC vD vE |
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| vA vB vC vD vE |
| [v2] v3 v4 v5 v6 |
| vU vW vX vY vZ |
--------------------------
Vertical scroll:
Before focus shifts
--------------------------
| [vA] vB vC vD vE |
| v1 v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
| vF vG vH vI vJ |
--------------------------
Thanks to section.orthogonalScrollingBehavior = .groupPaging the horizontal scrolling is working as expected. (I've put 1 item per group to achieve this)
But I'm going crazy with the vertical scroll, I'm not able to achieve it as expected, the focused section still centered verticaly on the screen ! What I'm getting:
Before focus shifts
--------------------------
| [vA] vB vC vD vE |
| v1 v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| vA vB vC vD vE |
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After an other focus shifts
--------------------------
| v1 v2 v3 v4 v5 |
| [vU] vW vX vY vZ |
| vF vG vH vI vJ |
--------------------------
I've tried to play with the didUpdateFocusIn function without success
func collectionView(_ collectionView: UICollectionView, didUpdateFocusIn context: UICollectionViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
if let nextFocusedItemIndexPath = context.nextFocusedIndexPath {
let section = nextFocusedItemIndexPath.section
let sectionIndexPath = IndexPath(item: 0, section: section)
collectionView.scrollToItem(at: sectionIndexPath, at: .top, animated: true)
}
}
The collectionview is behaving strangely when using the didUpdateFocusIn function and I feel it's not the good way to perform what I'm expecting...
I've also try to play with the scrollViewWillEndDragging function without success
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset:
}
Everything that I tried looks like a hack and I can't believe Apple has not plan something for this use case, which is in my sense a common use case....
FB14569448
Since iOS 18 beta came out, our app has been failing at some point when a view controller is dismissed and it appears the main thread ends up looping in layout logic and logs the following to the console. The app hangs until it's terminated due to a memory overallocation issue.
Anyone else seen this?
<_UINavigationBarItemStackEntry: 0x302ac73f0> normalLayout[active]=0x1391ad880 searchLayout=0x0 item=<UINavigationItem: 0x13913a080> style=navigator: Ignoring unexpected nonmatching counterpart: (null)
This is an internal UIKit bug.
Snapshotting a view (0x1391e7c00, _UIButtonBarStackView) that has not been rendered at least once requires afterScreenUpdates:YES.
frame #0: 0x000000019bb07000 libobjc.A.dylibobjc_msgSend frame #1: 0x00000001a0fb4224 UIKitCore-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 144
frame #2: 0x00000001c270a030 CoreAutoLayout-[NSISEngine withBehaviors:performModifications:] + 84 frame #3: 0x00000001a0fe5424 UIKitCore__100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 120
frame #4: 0x00000001a0fe3ae0 UIKitCore-[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 112 frame #5: 0x00000001a0fe2b4c UIKitCore-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 172
frame #6: 0x00000001a0fa9e90 UIKitCore-[UIView _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 400 frame #7: 0x00000001a0fa9a18 UIKitCore-[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 312
frame #8: 0x00000001a0fa97a4 UIKitCore-[UIView(Hierarchy) layoutSubviews] + 204 frame #9: 0x00000001a124fa78 UIKitCore-[_UIButtonBarStackView layoutSubviews] + 56
frame #10: 0x00000001a0f6430c UIKitCore-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2492 frame #11: 0x00000001a029d8d0 QuartzCoreCA::Layer::layout_if_needed(CA::Transaction*) + 496
frame #12: 0x00000001a0fa81d0 UIKitCore-[UIView(Hierarchy) layoutBelowIfNeeded] + 300 frame #13: 0x00000001a1843fa4 UIKitCore-[_UINavigationBarTransitionContextCrossfade _prepareContentView] + 132
frame #14: 0x00000001a18443bc UIKitCore-[_UINavigationBarTransitionContextCrossfade prepare] + 84 frame #15: 0x00000001a184e59c UIKitCore-[_UINavigationBarVisualProviderModernIOS _performAnimationWithTransitionCompletion:transition:] + 1524
frame #16: 0x00000001a180f938 UIKitCore-[UINavigationBar _popNavigationItemWithTransitionAssistant:] + 220 frame #17: 0x00000001a180f5f8 UIKitCore-[UINavigationBar _popNavigationItemWithTransition:] + 224
frame #18: 0x00000001a13bec9c UIKitCore-[UINavigationBar _setItemsUpToItem:transition:] + 240 frame #19: 0x00000001a13be76c UIKitCore-[UIViewController _removeNavigationItemsFromNavigationController:transition:] + 232
frame #20: 0x00000001a19c9dc0 UIKitCore__89-[UINavigationController _immediatelyApplyViewControllers:transition:animated:operation:]_block_invoke_3 + 800 frame #21: 0x00000001a19d0b2c UIKitCore__98-[UINavigationController _shouldSkipHostedRefreshControlUpdateSchedulingDeferredUpdateIfNecessary]_block_invoke + 40
frame #22: 0x00000001a19d7574 UIKitCore-[UINavigationController transitionConductor:didStartDeferredTransition:context:] + 792 frame #23: 0x00000001a21c9600 UIKitCore-[_UIViewControllerTransitionConductor startDeferredTransitionIfNeeded] + 688
frame #24: 0x00000001a10ab040 UIKitCore-[UINavigationController __viewWillLayoutSubviews] + 84 frame #25: 0x00000001a1350bcc UIKitCore-[UILayoutContainerView layoutSubviews] + 172
frame #26: 0x00000001a0f6430c UIKitCore-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2492 frame #27: 0x00000001a029d8d0 QuartzCoreCA::Layer::layout_if_needed(CA::Transaction*) + 496
frame #28: 0x00000001a029d45c QuartzCoreCA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 frame #29: 0x00000001a02f64e0 QuartzCoreCA::Context::commit_transaction(CA::Transaction*, double, double*) + 472
frame #30: 0x00000001a02736c4 QuartzCoreCA::Transaction::commit() + 648 frame #31: 0x00000001a02b6584 QuartzCoreCA::Transaction::flush_as_runloop_observer(bool) + 88
frame #32: 0x00000001a1002c3c UIKitCore_UIApplicationFlushCATransaction + 52 frame #33: 0x00000001a10002dc UIKitCore_UIUpdateSequenceRun + 84
frame #34: 0x00000001a0ffff2c UIKitCoreschedulerStepScheduledMainSection + 172 frame #35: 0x00000001a1000df0 UIKitCorerunloopSourceCallback + 92
frame #36: 0x000000019e7edf90 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 frame #37: 0x000000019e7edf24 CoreFoundation__CFRunLoopDoSource0 + 176
frame #38: 0x000000019e7eba10 CoreFoundation__CFRunLoopDoSources0 + 244 frame #39: 0x000000019e7eac14 CoreFoundation__CFRunLoopRun + 840
frame #40: 0x000000019e7ea4c8 CoreFoundationCFRunLoopRunSpecific + 572 frame #41: 0x00000001eb06d1c4 GraphicsServicesGSEventRunModal + 164
frame #42: 0x00000001a1334a90 UIKitCore-[UIApplication _run] + 816 frame #43: 0x00000001a13e2d1c UIKitCoreUIApplicationMain + 340
frame #44: 0x000000010038ca7c LabWare Developmentmain at AppDelegate.swift:31:7 frame #45: 0x00000001c4f4e9b4 dyldstart + 2724
The following:
tabBarController.tabs = [
UITab(title: "First",
image: UIImage(...),
identifier: "First Tab") { _ in
myViewController()
}
Works as expected. Tap on a a tab or sidebar item, and myViewController appears.
However, the following:
let collectionsGroup = UITabGroup(
title: "Lists",
image: nil,
identifier: "Tabs.CollectionsGroup",
children: [
UITab(title: "First", image: nil, identifier: "First Tab") { _ in
myViewController()
}
]) { _ in
fallbackViewController()
}
Does not work as expected. Tapping on any tab in the sidebar always displays fallbackViewController, instead of myViewController or any other specified view controllers in the given tab.
Am I doing something wrong, or is this a bug with the current betas?
Topic:
UI Frameworks
SubTopic:
UIKit
The following is a UIKit app that displays a collection view with list layout and diffable data source (one section, one row).
class ViewController: UIViewController {
var collectionView: UICollectionView!
var dataSource: UICollectionViewDiffableDataSource<String, String>!
override func viewDidLoad() {
super.viewDidLoad()
configureHierarchy()
configureDataSource()
}
func configureHierarchy() {
collectionView = .init(frame: .zero, collectionViewLayout: createLayout())
view.addSubview(collectionView)
collectionView.frame = view.bounds
collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
func createLayout() -> UICollectionViewLayout {
UICollectionViewCompositionalLayout { section, layoutEnvironment in
let config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
return NSCollectionLayoutSection.list(using: config, layoutEnvironment: layoutEnvironment)
}
}
func configureDataSource() {
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, String> { cell, indexPath, itemIdentifier in
var backgroundConfiguration = UIBackgroundConfiguration.listGroupedCell()
backgroundConfiguration.backgroundColor = .systemBlue
cell.backgroundConfiguration = backgroundConfiguration
}
dataSource = .init(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
collectionView.dequeueConfiguredReusableCell(using: cellRegistration, for: indexPath, item: itemIdentifier)
}
var snapshot = NSDiffableDataSourceSnapshot<String, String>()
snapshot.appendSections(["main"])
snapshot.appendItems(["demo"])
dataSource.apply(snapshot, animatingDifferences: false)
}
}
If you tap on the row, it seems like selection doesn't happen: giving the cell a blue background broke its default background color transformer.
Here's what I've tried and didn't work:
Setting the collection view's delegate and specifying that you can select any row
Setting the color transformer to .grayscale
Setting the backgroundConfiguration to UIBackgroundConfiguration.listGroupedCell().updated(for: cell.configurationState)
Combinations of the approaches above
Setting the color transformer to UIBackgroundConfiguration.listGroupedCell().backgroundColorTransformer and cell.backgroundConfiguration?.backgroundColorTransformer (they're both nil)
Setting the cell's backgroundColor directly
I also considered using a custom color transformer:
var backgroundConfiguration = UIBackgroundConfiguration.listGroupedCell()
backgroundConfiguration.backgroundColorTransformer = UIConfigurationColorTransformer { _ in
if cell.configurationState.isSelected || cell.configurationState.isHighlighted {
.systemBlue.withAlphaComponent(0.7)
} else {
.systemBlue
}
}
cell.backgroundConfiguration = backgroundConfiguration
However, if you push a view controller when you select the row, the row gets deselected, which is unfortunate, giving that I like to deselect rows in viewWillAppear(_:) to keep users more oriented.
There might be ways to circumvent this, but my custom color transformer might still differ from the default one in some other ways.
So how do I assign the default one to my cell?
Topic:
UI Frameworks
SubTopic:
UIKit
In iOS 18.0, UICollectionView/scrollToItem(at:at:animated:) causes UICollectionView to scroll with an awkward stuttered animation at about 4 frames per second on the device.
This behavior is not observed in iOS 15, 16, or 17.
I submitted FB13986989 about this issue 6 weeks ago when I first observed it in iOS 18 beta 1, but I have not received a response.
The issue has not been fixed in iOS 18.0 beta 2, 3, or 4.
Is this a known issue? Does Apple intend to fix it?
Assuming Apple has not prioritized fixing this bug, could a UIKit engineer suggest a workaround?
My app relies on scrollTo working properly and now looks awful on iOS 18.
Thank you for any assistance you can provide.
The following code, will create a red color text, without strike-through.
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let text = "Hello World"
let textCount = text.count
let fullRange = NSRange(location: 0, length: textCount)
var attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(.foregroundColor, value: UIColor.green, range: fullRange)
attributedText.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: fullRange)
label.attributedText = attributedText
attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(.foregroundColor, value: UIColor.red, range: fullRange)
attributedText.removeAttribute(NSAttributedString.Key.strikethroughStyle, range: fullRange)
label.attributedText = attributedText
}
}
However, if I trigger label.text in between, it will cause the following strange behavior : A red color text, with strike-through created at the end of function.
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let text = "Hello World"
let textCount = text.count
let fullRange = NSRange(location: 0, length: textCount)
var attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(.foregroundColor, value: UIColor.green, range: fullRange)
attributedText.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: fullRange)
label.attributedText = attributedText
// Why this will cause a red color text, with strike-through created at the end of function?
label.text = text
attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(.foregroundColor, value: UIColor.red, range: fullRange)
attributedText.removeAttribute(NSAttributedString.Key.strikethroughStyle, range: fullRange)
label.attributedText = attributedText
}
}
Does anyone what is the reason behind this behavior, and how I can avoid such? Thank you.
Topic:
UI Frameworks
SubTopic:
UIKit
To enable editing in the elevated Tab Bar or sidebar on iPadOS, we need to use UITabBar. However, using UITabBar restricts reordering in compact mode with the bottom tab bar. Instead of showing the tabs, the editing view only displays the message 'Drag the icons to organize tabs.' How can we resolve this issue?
Find demo project here
I have already searched for a lot of information about this issue. Many people have encountered it with UISplitViewController or on iPadOS, but I am experiencing this problem on iOS 18. It does occasionally occur on iOS 17, but it definitely happens on iOS 18. The error messages are as follow:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Layout requested for visible navigation bar, <UINavigationBar: 0x14a6b3c00; frame = (0 44; 375 44); autoresize = W; tintColor = UIExtendedGrayColorSpace 1 1; layer = <CALayer: 0x3026a9da0>> delegate=0x14a674600 standardAppearance=0x300d1d0a0 scrollEdgeAppearance=0x300d1cf50, when the top item belongs to a different navigation bar. topItem = <UINavigationItem: 0x14a7f8780> style=navigator leftBarButtonItems=0x302423b40, navigation bar = <UINavigationBar: 0x14adcb700; frame = (0 0; 375 44); autoresize = W; tintColor = UIExtendedGrayColorSpace 1 1; layer = <CALayer: 0x302680940>> delegate=0x14ade8c00 standardAppearance=0x300d7a7d0 scrollEdgeAppearance=0x300d7a610, possibly from a client attempt to nest wrapped navigation controllers.'
*** First throw call stack:
(0x193f3a08c 0x191242698 0x19330a8fc 0x196939290 0x1966847b4 0x1967cdc88 0x1959ba6d8 0x1966c86bc 0x196769d50 0x1967cae58 0x196771f28 0x196b0fcb8 0x196764800 0x196684280 0x1959ba6d8 0x1959ba264 0x195a12edc 0x195990560 0x1968295f0 0x193f1c218 0x193f0a4c0 0x193f09b84 0x193f09368 0x1e00fc1c4 0x196a569b0 0x196b04d54 0x10462b1fc 0x1ba144734)
libc++abi: terminating due to uncaught exception of type NSException
I am sure about the process on iOS 17, first I use UINavigationController.present(UINavigationController()) and then call keyWindow.rootViewController = UINavigationController(), it crashes. So I can dismiss the presentedViewController before assign keyWindow.rootViewController. However, on iOS 18, the app crash when launch.
I'm in the process of rewriting a TableView as a modern CollectionView, using UICollectionLayoutListConfiguration and UICollectionViewCompositionalLayout.list together with a diffable data source.
One feature of our TableView is that it has section headers that are pinned when scrolling (plain table view style). They also change their background based on whether they are currently pinned or not. This is accomplished by setting UITableViewHeaderFooterView's automaticallyUpdatesBackgroundConfiguration to false and override updateConfiguration(using:).
However, I don't see a way of doing the same for a CollectionView's header. I can easily provide a header view by setting the supplementaryViewProvider of the data source, and they are sticky thanks to UICollectionLayoutListConfiguration.Appearance.plain But the header view itself is a UICollectionReusableView which does not seem to have the same mechanism as UITableViewHeaderFooterView for reacting to changes to the pinned state.
Is it at all possible to accomplish this with CollectionView headers? If so, how?
Topic:
UI Frameworks
SubTopic:
UIKit
In iOS 18 beta 5 version, setting the conversion to NSAttributedString using [.documentType: NSAttributedString.DocumentType.html] occasionally causes crashes.
The same issue was encountered in previous versions. However, after running the code on the main thread, it no longer crashed. But after upgrading to the iOS 18 beta 5 version, it occasionally crashes even when running on the main thread.
How can this issue be resolved?
thx~
after update to iOS 18 beta5,We found that the next code will crash.
When we use html string to generate to a NSMutableAttributedString object. It will be crash.
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithData:[@"some html string" dataUsingEncoding:NSUTF8StringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute : @(NSUTF8StringEncoding) } documentAttributes:nil error:nil];
Topic:
UI Frameworks
SubTopic:
UIKit
Hi everyone,
I'm trying to solve an issue with focus not being updated in UISearchController keyboard after some letters are typed (one or more if I'm lucky enough to swipe quickly).
This started happening when I switched to Xcode 15 and the latest tvOS SDK.
The focus engine logs do not explain much to me
The result of the focus update was determined from the following preferred focus search:
|
| Starting preferred focus search.
| <UIViewController: 0x10711d180>
| └ <RCTRootView: 0x10711a810>
| │ No more preferred environments. Trying to infer environment from visual layout...
| │ Found environment: <UIKeyboard: 0x105ffcc40>
| └ <UIKeyboard: 0x105ffcc40>
| (info) It's focusable!
|
Moving focus from <UIKeyboard: 0x105ffcc40> to <UIKeyboard: 0x105ffcc40> in focus system <UIFocusSystem: 0x303568600>.
Ignoring focus update request for disappearing focus environment <UIKBFloatingKeyView: 0x105eeb130>.
<<TYPE LETTER GOES HERE >>
- ISSUE: This environment does not contain the currently focused item.
Ignoring focus update request for disappearing focus environment <_UITextLayoutFragmentView: 0x105fff620>.
- ISSUE: This environment does not contain the currently focused item.
Ignoring focus update request for disappearing focus environment <UISearchBarTextFieldLabel: 0x105ff6f70>.
- ISSUE: This environment does not contain the currently focused item.
Ignoring focus update request for disappearing focus environment <UILabel: 0x105ff5090>.
- ISSUE: This environment does not contain the currently focused item.
In the "focus-freeze" state is not possible to swipe anymore, but I still can repeat typing of the last letter.
I'd appreciate any hints on how to debug this problem.
Is it possible to list gesture recognizers or other objects that are consuming TV remote events ?
I've confirmed the the [UIWindow sendEvent:] is still being triggered.
I'm experiencing an issue in my iOS app where tapping to select text in a UITextView that is embedded within a UIScrollView causes the scroll view to jump to an incorrect position. This problem seems to occur only on iOS 15. Does anyone know how to fix this issue, or is there a known bug regarding this behavior on iOS 15?
class ViewController: UIViewController, UITextViewDelegate, UIGestureRecognizerDelegate {
@IBOutlet weak var textView: UITextView!
@IBOutlet weak var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
textView.isScrollEnabled = false
textView.layoutManager.allowsNonContiguousLayout = false
}
}
so, we used iOS18 beat5 int our APP,
crash list:
try self.init(data: data, options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil)
html to NSAttributedString crash
UINavigationController.viewControllers.remove(at: referIndex)
Topic:
UI Frameworks
SubTopic:
UIKit