Hello
How are you?
I tried to used XLPagerTabStrip library.
It worked great.
When I add new menu programmatically . I received crash issue.
I tried to call self.reloadPagerTabStripView() to reload menus.
I got crash issue on this part:
for index in childViewControllers.indices {
let nElements = childViewControllers.count - index
let n = (Int(arc4random()) % nElements) + index
if n != index {
childViewControllers.swapAt(index, n)
}
}
let nItems = 1 + (arc4random() % UInt32(childViewControllers.count))
return Array(childViewControllers.prefix(Int(nItems)))
So I removed these lines. and just added
return childViewControllers
And tried to continue.
But still got crash issue.
//ButtonBarPagerTabStripViewController.swift
// MARK: - UICollectionViewDelegateFlowLayut
@objc open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize {
guard let cellWidthValue = cachedCellWidths?[indexPath.row] else {
fatalError("cachedCellWidths for \(indexPath.row) must not be nil")
}
return CGSize(width: cellWidthValue, height: collectionView.frame.size.height)
}
seems to be related to cachedCellWidths.
crash reason was "Thread 1: Fatal error: Index out of range"
I debugged .
cachedCellWidths had 4 values. and indexPath.row was 4.
I tried to add or remove menus programmatically.
Could you explain me how can i fix issue?
Thank you
Hello How are you? I tried to used XLPagerTabStrip library. It worked great. When I add new menu programmatically . I received crash issue. I tried to call self.reloadPagerTabStripView() to reload menus. I got crash issue on this part:
So I removed these lines. and just added
return childViewControllers
And tried to continue. But still got crash issue. //ButtonBarPagerTabStripViewController.swift // MARK: - UICollectionViewDelegateFlowLayut
seems to be related to cachedCellWidths. crash reason was "Thread 1: Fatal error: Index out of range"
I debugged . cachedCellWidths had 4 values. and indexPath.row was 4. I tried to add or remove menus programmatically. Could you explain me how can i fix issue? Thank you