Tab bar items with scroll

0

I'm doing an app for iphone that has a tab bar controller with 4 elements, the problem is that the titles are long and there is very little space.

Is there any way to make the tabs scroll so that the last element appears to scroll in the bar of the tabs?

    
asked by Alberto Mier 29.05.2018 в 11:55
source

1 answer

1

A good alternative is to use a collectionView and enable the page. For example if you have 5 elements and with the ideal size of each tab (or cell in this case) only fit 4, assign the width of each cell like this:

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
     return CGSize(width: screenWidth/4, height: 100)
}

The remaining element will be visible when you scroll.

    
answered by 29.05.2018 в 16:20