Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Swift more than one behaviour in the same UICollectionView

I add a custom collectionViewLayout to CollectionView. I have 6 cells and I pass the next item with default animation style. But when I pass the last cell I want to make an animation as PageAnimation(custom). I add the collectionViewLayout in the viewDidLoad but it effects all cells.

let layout = AnimatedCollectionViewLayout()
layout.animator = PageAttributesAnimator()
layout.scrollDirection = .horizontal
collectionView.collectionViewLayout = layout

How can I use 2 different layout types in one CollectionView ?

Thanks in advance.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        for cell: UICollectionViewCell in clcView.visibleCells {
            let indexPath: IndexPath? = clcView.indexPath(for: cell)
            if let indexPath = indexPath {
                print("\(indexPath)")
                if indexPath.row >= 2 {
                    let layout = AnimatedCollectionViewLayout()
                    layout.animator = PageAttributesAnimator()
                    layout.scrollDirection = .horizontal
                    clcView.collectionViewLayout = layout
                }
                else {
                    let layout = AnimatedCollectionViewLayout()
                    layout.animator = RotateInOutAttributesAnimator()
                    layout.scrollDirection = .horizontal
                    clcView.collectionViewLayout = layout
                }
            }
        }
    }
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda