欢迎大家访问我的博客http://blog.csdn.net/mikejaps,专注于android ios app 开发
UICollectionView UITableView registerNib和registerClass的回调
//从nib加载
[deviceContainer registerNib:[UINib nibWithNibName:@"Cell" bundle:nil] forCellWithReuseIdentifier:@"CellView"];
<pre name="code" class="objc">//回调
-(void)awakeFromNib
//从class加载
<span style="font-family: Arial, Helvetica, sans-serif;">[deviceContainer registerClass:[MyViewCell class] forCellWithReuseIdentifier:@"CellView"];</span>
//回调
-(id)initWithFrame:(CGRect)frame
//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * CellIdentifier = @"CellView";
CellView * cell = (CellView*)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
cell.lable.text=@"ssss";
return cell;
}