![](/img/trans.png)
[英]It's possible to customize UICollectionView for displaying few sections like one?
[英]It's possible customize cell in a UICollectionView?
經過幾個小時的谷歌搜索,我找不到解決方案..
我想將這些屬性添加到單元格,但此代碼不起作用
AppCell *cell = [[AppCell alloc] init];
cell.layer.cornerRadius = 5.0;
cell.layer.shadowColor = [[UIColor blackColor] CGColor];
cell.layer.shadowOpacity = 1.0;
cell.layer.shadowRadius = 10.0;
cell.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
解決辦法是什么?? ..非常感謝你提前
首先,創建一個CustomCell,它是UICollectionViewCell的子類。然后,將CustomCell.h文件導入到collectionView的控制器中。
如果要在某些單元格上設置這些屬性,請使用委托方法- (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath
如果要為所有單元設置這些屬性,只需將它們放在CustomCell.m.Remember導入QuartzCore框架中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.