集合視圖的頭部視圖

-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
注冊(cè)

[self.collectionView registerClass:[ToolHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:ToolHeaderViewIdentifier];

{
UICollectionReusableView *reusableView =nil;

if (kind == UICollectionElementKindSectionHeader) {
    //定制頭部視圖的內(nèi)容
    ToolHeaderView *headerV = [ToolHeaderView returnResueCellFormTableView:self.collectionView indexPath:indexPath identifier:ToolHeaderViewIdentifier];
    headerV.titleLb.text = [NSString stringWithFormat:@"熱賣(mài)品類(lèi) %ld", (long)indexPath.section];
    headerV.titleFont = [UIFont systemFontOfSize:14];
    headerV.titleTextColor = [UIColor redColor];
    headerV.headerViewBgColor = [UIColor whiteColor];
    
    reusableView = headerV;
} else if (kind == UICollectionElementKindSectionFooter) {
    GoodsReclassFootView *footView = [GoodsReclassFootView returnResueCellFormTableView:self.collectionView indexPath:indexPath identifier:GoodsReclassFootViewIdentifier];
    footView.backgroundColor = BackCellColor;
    reusableView = footView;
}

return reusableView;

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • UICollectionView網(wǎng)格視圖 網(wǎng)格視圖是能夠顯示多列的列表視圖, 彌補(bǔ)了UITableView不方便實(shí)...
    Vinc閱讀 8,653評(píng)論 8 36
  • 菜鳥(niǎo)的我來(lái)了,先喝杯茶壓壓驚。 要使用CollectionView里面的頭視圖需要先注冊(cè)頭視圖 UICollect...
    一方自在閱讀 12,889評(píng)論 0 3
  • 經(jīng)常在很多音樂(lè)MV中看到周格泰這個(gè)名字,但凡是他導(dǎo)的MV基本深得我心,每一首歌就是一個(gè)故事,每一個(gè)MV就是一部小...
    DiannaH閱讀 306評(píng)論 1 0
  • 昨天加入前頭馬D85大區(qū)總監(jiān)龍兄的一個(gè)堅(jiān)持寫(xiě)作的群,打算堅(jiān)持每天寫(xiě)點(diǎn)東西,記錄自己的生活。正好今天做了兩頓飯,...
    周周要堅(jiān)持閱讀 534評(píng)論 0 2
  • 夏日似乎也沒(méi)有那么難熬。 躺在吊床上,曬著太陽(yáng),聽(tīng)著蛙聲與鳥(niǎo)叫,看著那些綠和藍(lán),花和草。 貓sir在遠(yuǎn)處釣魚(yú),打窩...
    西瓜貓貓閱讀 198評(píng)論 0 0

友情鏈接更多精彩內(nèi)容