collectionView 复用和注册

2017-05-05  本文已影响105人  半江瑟瑟

//
// ViewController.m
// test-alert
//
// Created by 姜维克 on 2017/4/20.
// Copyright © 2017年 O2O_iOS_jiangweike. All rights reserved.
//

import "ViewController.h"

@interface WKCollectionView : UICollectionView

@end

@interface WKCollectionView ()
//@property (nonatomic, strong) UICollectionView *collection;
@end
@implementation WKCollectionView
@end

@interface WKCollectionViewCell : UICollectionViewCell

@end

@interface WKCollectionViewCell ()
@property (nonatomic, strong) UILabel *testLabel;
@end

@implementation WKCollectionViewCell

//必须重写initWithFrame 方法 否则deque方法 第一次得到的cell 的testLabel是nil

@end

@interface ViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic, strong) UICollectionView *collection;
@property (nonatomic, strong) NSIndexPath *indexPath;
@property (nonatomic, strong) WKCollectionViewCell *oldCell;
@end

@implementation ViewController

}

static NSString * const reuseIdentifier = @"Cell";

pragma mark - UICollectionViewDataSource

上一篇下一篇

猜你喜欢

热点阅读