美文网首页
OC: UICollectionView+MaxMethod

OC: UICollectionView+MaxMethod

作者: 一欧Yiou | 来源:发表于2018-11-06 15:37 被阅读1次

.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

相关文章

网友评论

      本文标题:OC: UICollectionView+MaxMethod

      本文链接:https://www.haomeiwen.com/subject/fdyuxqtx.html