This repository has been archived by the owner on Sep 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
将RKOCell从原先的控件库转移到工具库。
- Loading branch information
Showing
4 changed files
with
138 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// RKOCell.h | ||
// Summary01_Rakuyo | ||
// | ||
// Created by Rakuyo on 2017/8/14. | ||
// Copyright © 2017年 Rakuyo. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface RKOCell : UITableViewCell | ||
|
||
/** | ||
快速获取 cell | ||
@param tableView 当前的tableView | ||
@return 一个普通的cell | ||
*/ | ||
+ (instancetype)cell:(UITableView *)tableView; | ||
|
||
/** | ||
从xib中获取cell | ||
@param tableView 当前的tableView | ||
@return 从xib中获取到的cell | ||
*/ | ||
+ (instancetype)xibCell:(UITableView *)tableView; | ||
|
||
/** | ||
获取一个空白的cell | ||
@param tableView 当前的tableView | ||
@return 一个空白的cell | ||
*/ | ||
+ (id)blankCell:(UITableView *)tableView; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// RKOCell.m | ||
// Summary01_Rakuyo | ||
// | ||
// Created by Rakuyo on 2017/8/14. | ||
// Copyright © 2017年 Rakuyo. All rights reserved. | ||
// | ||
|
||
#import "RKOCell.h" | ||
|
||
@implementation RKOCell | ||
|
||
// 快速获取 cell | ||
+ (instancetype)cell:(UITableView *)tableView { | ||
NSString *ID = NSStringFromClass(self); | ||
RKOCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
|
||
if (!cell) { | ||
[tableView registerClass:self forCellReuseIdentifier:ID]; | ||
cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
} | ||
|
||
return cell; | ||
} | ||
|
||
// 从xib中获取cell | ||
+ (instancetype)xibCell:(UITableView *)tableView { | ||
NSString *ID = NSStringFromClass(self); | ||
RKOCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
|
||
if (!cell) { | ||
[tableView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellReuseIdentifier:ID]; | ||
cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
} | ||
|
||
return cell; | ||
} | ||
|
||
// 获取一个空白的cell | ||
+ (id)blankCell:(UITableView*)tableView { | ||
static NSString *const ID = @"RKOBlanckCellID"; | ||
|
||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
if (!cell) { | ||
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:ID]; | ||
cell = [tableView dequeueReusableCellWithIdentifier:ID]; | ||
} | ||
return cell; | ||
} | ||
|
||
@end |