.h文件
#import <UIKit/UIKit.h>
@interface UICollectionView (MaxMethod)
- (void)registerNib:(NSString *)nibName;
- (void)registerClass:(NSString *)className;
@end
.m文件
#import "UICollectionView+MaxMethod.h"
@implementation UICollectionView (MaxMethod)
- (void)registerNib:(NSString *)nibName {
UINib *nib = [UINib nibWithNibName:nibName bundle:[NSBundle mainBundle]];
[self registerNib:nib forCellWithReuseIdentifier:nibName];
}
- (void)registerClass:(NSString *)className {
[self registerClass:NSClassFromString(className) forCellWithReuseIdentifier:className];
}
@end
网友评论