ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Sticky Headers - Custom Collection View Layouts - raywenderlich.com

Автор: Kodeco

Загружено: 2017-04-26

Просмотров: 13278

Описание: In this video, you'll learn about to create the sticky headers which you can typically find in a UITableView.

----
About www.raywenderlich.com:

raywenderlich.com is a website focused on developing high quality programming tutorials. Our goal is to take the coolest and most challenging topics and make them easy for everyone to learn – so we can all make amazing apps.

We are also focused on developing a strong community. Our goal is to help each other reach our dreams through friendship and cooperation. As you can see below, a bunch of us have joined forces to make this happen: authors, editors, subject matter experts, app reviewers, and most importantly our amazing readers!
----

From Apple Developer Docs:

A collection view is a way to present an ordered set of data items using a flexible and changeable layout. The most common use for collection views is to present items in a grid-like arrangement, but collection views in iOS are capable of more than just rows and columns. With collection views, the precise layout of visual elements is definable through subclassing and can be changed dynamically, so you can implement grids, stacks, circular layouts, dynamically changing layouts, or any type of arrangement you can imagine.

Collection views keep a strict separation between the data being presented and the visual elements used to present that data. In most cases, your app is solely responsible for managing the data. Your app also provides the view objects used to present that data. After that, the collection view takes your views and does all the work of positioning them onscreen. It does this work in conjunction with a layout object, which specifies the placement and visual attributes for your views and that can be subclassed to fit your app’s exact needs. Thus, you provide the data, the layout object provides the placement information, and the collection view merges the two pieces together to achieve the final appearance.

Creating Custom Layouts

Before you start building custom layouts, consider whether doing so is really necessary. The UICollectionViewFlowLayout class provides a significant amount of behavior that has already been optimized for efficiency and that can be adapted in several ways to achieve many different types of standard layouts. The only times to consider implementing a custom layout are in the following situations:

The layout you want looks nothing like a grid or a line-based breaking layout (a layout in which items are placed into a row until it’s full, then continue on to the next line until all items are placed) or necessitates scrolling in more than one direction.

You want to change all of the cell positions frequently enough that it would be more work to modify the existing flow layout than to create a custom layout.

The good news is that, from an API perspective, implementing a custom layout is not difficult. The hardest part is performing the calculations needed to determine the positions of items in the layout. When you know the locations of those items, providing that information to the collection view is straightforward.

Creating Layout Attributes

The attributes objects that your layout is responsible for are instances of the UICollectionViewLayoutAttributes class. These instances can be created in a variety of different methods in your app. When your app is not dealing with thousands of items, it makes sense to create these instances while preparing the layout, because the layout information can be cached and referenced rather than computed on the fly. If the costs of computing all the attributes up front outweighs the benefits of caching in your app, it is just as easy to create attributes in the moment when they are requested.

Regardless, when creating new instances of the UICollectionViewLayoutAttributes class, use one of the following class methods:

layoutAttributesForCellWithIndexPath:
layoutAttributesForSupplementaryViewOfKind:withIndexPath:
layoutAttributesForDecorationViewOfKind:withIndexPath:
You must use the correct class method based on the type of the view being displayed because the collection view uses that information to request the appropriate type of view from the data source object. Using the incorrect method causes the collection view to create the wrong views in the wrong places and your layout does not appear as intended.

After creating each attributes object, set the relevant attributes for the corresponding view. At a minimum, set the size and position of the view in the layout. In cases where the views of your layout overlap, assign a value to the zIndex property to ensure a consistent ordering of the overlapping views. Other properties let you control the visibility or appearance of the cell or view and can be changed as needed. If the standard attributes class does not suit your app’s needs, you can subclass and expand it to store other information about each view.

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Sticky Headers  - Custom Collection View Layouts - raywenderlich.com

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Featured Cell - Custom Collection View Layouts - raywenderlich.com

Featured Cell - Custom Collection View Layouts - raywenderlich.com

Мир близко? Переговоры в Абу-Даби

Мир близко? Переговоры в Абу-Даби

Objective-C Memory Management - raywenderlich.com

Objective-C Memory Management - raywenderlich.com

Как создать сайт на Wix — руководство для начинающих

Как создать сайт на Wix — руководство для начинающих

Swift: How to Migrate MVC to MVVM & Intro Unit Testing

Swift: How to Migrate MVC to MVVM & Intro Unit Testing

Музыка для работы за компьютером | Фоновая музыка для концентрации и продуктивности

Музыка для работы за компьютером | Фоновая музыка для концентрации и продуктивности

Лучший Гайд по Kafka для Начинающих За 1 Час

Лучший Гайд по Kafka для Начинающих За 1 Час

Лучшая Музыка 2026🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно 2026 #28

Лучшая Музыка 2026🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно 2026 #28

Учебник по monday.com для начинающих

Учебник по monday.com для начинающих

DIY - Stretchy Headers - Custom Collection View Layouts - raywenderlich.com

DIY - Stretchy Headers - Custom Collection View Layouts - raywenderlich.com

Playlist,,Deep House,Music Played in Louis Vuitton Stores

Playlist,,Deep House,Music Played in Louis Vuitton Stores

Winter Energy ❄️ Happy Day Playlist 2026 ☀️ Positive Chill House Music

Winter Energy ❄️ Happy Day Playlist 2026 ☀️ Positive Chill House Music

Лучшая Музыка 2026🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно 2026 #27

Лучшая Музыка 2026🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно 2026 #27

Workspaces and Frameworks- Xcode 9 Tips and Tricks -  raywenderlich.com

Workspaces and Frameworks- Xcode 9 Tips and Tricks - raywenderlich.com

Wake Up Happy 2026 ☀️ Uplifting Morning Vibes to Start Your Perfect Day ☕Chillout Playlist

Wake Up Happy 2026 ☀️ Uplifting Morning Vibes to Start Your Perfect Day ☕Chillout Playlist

Представление коллекции в ячейке табличного представления (руководство по Swift) — Xcode 11, разр...

Представление коллекции в ячейке табличного представления (руководство по Swift) — Xcode 11, разр...

The Time Profiler - Practical Instruments with iOS 10 - raywenderlich.com

The Time Profiler - Practical Instruments with iOS 10 - raywenderlich.com

Create Stretchy Header Effect for UITableView and UICollectionView - iOS Development Tutorial

Create Stretchy Header Effect for UITableView and UICollectionView - iOS Development Tutorial

Штраус. Лучшее.

Штраус. Лучшее.

Parallax Effect - Custom Collection View Layouts - raywenderlich.com

Parallax Effect - Custom Collection View Layouts - raywenderlich.com

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]