Верхний и нижний колонтитулы не будут отображаться (Swift)

~ Новое в Swift~

Ниже представлена ​​функция, которую я должен внедрить в верхний и нижний колонтитулы в моем UICollectionView, но на данный момент, когда я запускаю свое приложение, ничего не появляется.

func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
    switch  kind {
    case UICollectionElementKindSectionHeader:
      let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "Header", forIndexPath: indexPath) 
      headerView.backgroundColor = UIColor.brownColor()
      return headerView
    case UICollectionElementKindSectionFooter:
      let footerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "Footer", forIndexPath: indexPath)
      footerView.backgroundColor = UIColor.darkGrayColor()
      return footerView
    default:
      assert(false, "Unexpected element kind")
    }
 }

0 ответов

Другие вопросы по тегам