2013-05-04 61 views
0

小時後google搜索,我發現沒有解決方案..可以在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); 

什麼解決的辦法? .. 非常感謝你提前

回答

2

首先,創建一個CustomCell這是UICollectionViewCell的子類。然後,將該CustomCell.h文件導入到您的collectionView的控制器。

如果你想設置的那些屬性上的一些細胞,使用委託方法- (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath

如果要設置這些屬性的所有單元格,只是把它們CustomCell.m.Remember進口QuartzCore框架內。

相關問題