12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // UITableViewCell+MAC.m
- // WeiSchoolTeacher
- //
- // Created by MacKun on 15/12/18.
- // Copyright © 2015年 MacKun. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import <objc/runtime.h>
- #import "UITableViewCell+MAC.h"
- @implementation UITableViewCell(MAC)
- - (void)setIsSelect:(BOOL)isSelect{
- objc_setAssociatedObject(self, @"isSelect", @(isSelect), OBJC_ASSOCIATION_ASSIGN);
- }
- - (BOOL)isSelect{
- return [objc_getAssociatedObject(self, @"isSelect") boolValue];
- }
- /**
- * @brief 加载同类名的nib
- *
- * @return cell
- */
- +(id)nibCell{
- // NSArray *nib = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil];
- //
- // return [nib objectAtIndex:0];
- return [[[UINib nibWithNibName:NSStringFromClass([self class]) bundle:nil]instantiateWithOwner:nil options:nil] objectAtIndex:0];
- }
- + (NSString*)cellIdentifier {
-
- return NSStringFromClass(self);
- }
- + (id)loadFromCellStyle:(UITableViewCellStyle)cellStyle {
-
- return [[self alloc] initWithStyle:cellStyle reuseIdentifier:NSStringFromClass(self)];
- }
- @end
|