Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda