Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ' ran into an error when computing the layout for section at index 23 in container. .
Container calculated by applying insets ({0, 0, 0, 0}) from sectionInsetsReference "safeArea" to collection view frame {{0, 110}, {390, 620}}.
Error: NSCollectionLayoutItem created with invalid combination of spacing and size specified. This group cannot fit even a single item. Inspect the spacing and size of the items in this group and ensure that they fit into the group when its effective size is {358, 36}.
Group:
layoutDirection: .horizontal
interItemSpacing = .fixed(10)
subitems = '
у меня возникла эта ошибка, но я ее не совсем понимаю, почему я не понимаю?
Эффективный размер группы – {358, 36}, размер элемента — {30,36}, тогда почему он не может поместиться в один элемент?? хотя ширина элемента намного меньше ширины группы
static func ReviewerTagsCellCompositionalLayout(envWidth: CGFloat) -> NSCollectionLayoutSection {
let leadingInset : CGFloat = 16
let trailingInset : CGFloat = 16
// Define the size for each item
let itemSize = NSCollectionLayoutSize(widthDimension: .estimated(30), heightDimension: .absolute(36))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
// Create a horizontal group with multiple items in the same row
let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(envWidth), heightDimension: .absolute(36))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems:[item])
// Adjust the inter-item spacing if needed
group.interItemSpacing = .fixed(10)
// Create the section
let section = NSCollectionLayoutSection(group: group)
section.interGroupSpacing = 10
section.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: leadingInset, bottom: 30, trailing: trailingInset)
section.orthogonalScrollingBehavior = .none
return section
}any possible solutions?
что я пробовал?
придать группе абсолютную ширину из среды и из UIWindow!
пробовал убрать интервалы между группами в разделах и элементами в группе
Я использую композиционный макет UICollection View для расчета элементов и групп
Я столкнулся с этой ошибкой [code]Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ' ran into an error when computing the layout for section at index 23 in container. .
Container calculated by applying insets ({0, 0, 0, 0}) from sectionInsetsReference "safeArea" to collection view frame {{0, 110}, {390, 620}}.
Error: NSCollectionLayoutItem created with invalid combination of spacing and size specified. This group cannot fit even a single item. Inspect the spacing and size of the items in this group and ensure that they fit into the group when its effective size is {358, 36}. Group: layoutDirection: .horizontal interItemSpacing = .fixed(10) subitems = ' [/code] у меня возникла эта ошибка, но я ее не совсем понимаю, почему я не понимаю? [list] [*] Эффективный размер группы – {358, 36}, размер элемента — {30,36}, тогда почему он не может поместиться в один элемент?? хотя ширина элемента намного меньше ширины группы [/list] [code]// the envWidth is set from UICollectionViewCompositionalLayout closure let envWidth = env.container.contentSize.width - 32 [/code] [code] static func ReviewerTagsCellCompositionalLayout(envWidth: CGFloat) -> NSCollectionLayoutSection { let leadingInset : CGFloat = 16 let trailingInset : CGFloat = 16 // Define the size for each item let itemSize = NSCollectionLayoutSize(widthDimension: .estimated(30), heightDimension: .absolute(36)) let item = NSCollectionLayoutItem(layoutSize: itemSize)
// Create a horizontal group with multiple items in the same row let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(envWidth), heightDimension: .absolute(36)) let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems:[item])
// Adjust the inter-item spacing if needed group.interItemSpacing = .fixed(10)
return section }any possible solutions? [/code] что я пробовал? [list] [*]придать группе абсолютную ширину из среды и из UIWindow![*]пробовал убрать интервалы между группами в разделах и элементами в группе [/list]