Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit 0cfb5a7

Browse files
committed
添加 RKOCell类。
将RKOCell从原先的控件库转移到工具库。
1 parent d87f273 commit 0cfb5a7

File tree

4 files changed

+138
-26
lines changed

4 files changed

+138
-26
lines changed

README.md

+45-17
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
自己平时写的一个小工具库,上传到**GitHub**中且支持`CocoaPods`,方便自己使用。不断更新完善中。
44

5-
**注意:**`1.3.4`之前的版本集成了自己写的一些控件,从`1.3.4`版本开始,这些控件不再集成到`RKOTools`库中了,将会单独提供并支持`CocoaPods`。该页面则做目录之用,将会列出所有控件。
5+
**注意:**`1.4.0`之前的版本集成了自己写的一些控件,从`1.4.0`版本开始,这些控件不再集成到`RKOTools`库中了,将会单独提供并支持`CocoaPods`。该页面则做目录之用,将会列出所有控件。
66

77
<p align="center">
8-
<a href=""><img src="https://img.shields.io/badge/pod-v1.3.4-brightgreen.svg"></a>
8+
<a href=""><img src="https://img.shields.io/badge/pod-v1.4.0-brightgreen.svg"></a>
99
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
1010
<a href=""><img src="https://img.shields.io/badge/platform-iOS%208.0%2B-ff69b5152950834.svg"></a>
1111
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
@@ -15,19 +15,19 @@
1515

1616

1717
1. [RKOTools](#rkotools-1)
18-
1. [NetWorkTool](#networktool)
19-
2. [CloseKeyBoard](#closekeyboard)
20-
3. [CollecionLog](#collecionlog)
21-
4. [TopViewController](#topviewcontroller)
22-
5. [CALayer+Additions](#calayeradditions)
23-
6. [ImageWithColor](#imagewithcolor)
24-
7. [~~FastFrame~~](#fastframe)
18+
1. [RKOCell](#rkocell)
19+
2. [NetWorkTool](#networktool)
20+
3. [CloseKeyBoard](#closekeyboard)
21+
4. [CollecionLog](#collecionlog)
22+
5. [TopViewController](#topviewcontroller)
23+
6. [CALayer+Additions](#calayeradditions)
24+
7. [ImageWithColor](#imagewithcolor)
25+
8. [~~FastFrame~~](#fastframe)
2526
2. [RKOControl](#rkocontrol)
2627
1. [RKONetworkAlert](#rkonetworkalert)
27-
2. [RKOCell](#rkocell)
28-
3. [RKOTextView](#rkotextview)
29-
4. [RKOTopAlert](#rkotopalert)
30-
5. [~~RKOTabBar~~](#rkotabbar)
28+
2. [RKOTextView](#rkotextview)
29+
3. [RKOTopAlert](#rkotopalert)
30+
4. [~~RKOTabBar~~](#rkotabbar)
3131
3. [BLOG](#blog)
3232

3333
## RKOTools
@@ -36,6 +36,38 @@
3636

3737
---------------------------------------------------------------------
3838

39+
### RKOCell
40+
41+
`xib`或者自定义`Cell`中快速获取`Cell`的一个小工具。接口如下所示:
42+
43+
```objc
44+
/**
45+
快速获取 cell
46+
47+
@param tableView 当前的tableView
48+
@return 一个普通的cell
49+
*/
50+
+ (instancetype)cell:(UITableView *)tableView;
51+
52+
/**
53+
从xib中获取cell
54+
55+
@param tableView 当前的tableView
56+
@return 从xib中获取到的cell
57+
*/
58+
+ (instancetype)xibCell:(UITableView *)tableView;
59+
60+
/**
61+
获取一个空白的cell
62+
63+
@param tableView 当前的tableView
64+
@return 一个空白的cell
65+
*/
66+
+ (id)blankCell:(UITableView *)tableView;
67+
```
68+
69+
---------------------------------------------------------------------
70+
3971
### NetWorkTool
4072

4173
自定义封装的`AFNetworking`。初学乍道还不是很完善。
@@ -284,10 +316,6 @@ UIKIT_EXTERN NSString * const baseURL;
284316

285317
---------------------------------------------------------------------
286318

287-
### RKOCell
288-
289-
---------------------------------------------------------------------
290-
291319
### RKOTextView
292320

293321
---------------------------------------------------------------------

RKOTools.podspec

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Pod::Spec.new do |s|
1010

1111
s.name = "RKOTools"
12-
s.version = "1.3.4"
12+
s.version = "1.4.0"
1313
s.summary = "One of your own tool libraries"
1414
s.description = <<-DESC
1515
One of your own tool libraries
@@ -30,11 +30,6 @@ Pod::Spec.new do |s|
3030

3131
# s.subspec 'RKOControl' do |control|
3232

33-
# control.subspec 'RKOCell' do |cell|
34-
35-
# cell.source_files = "RKOTools/RKOControl/RKOCell/*.{h,m}"
36-
# end
37-
3833
# control.subspec 'RKONetworkAlert' do |networkAlert|
3934

4035
# networkAlert.source_files = "RKOTools/RKOControl/RKONetworkAlert/*.{h,m}"
@@ -53,8 +48,10 @@ Pod::Spec.new do |s|
5348

5449
# end
5550

51+
s.subspec 'RKOCell' do |cell|
5652

57-
# s.subspec 'RKOHelper' do |helper|
53+
cell.source_files = "RKOTools/RKOCell/*.{h,m}"
54+
end
5855

5956
s.subspec 'CALayer+Additions' do |additions|
6057

@@ -87,6 +84,4 @@ Pod::Spec.new do |s|
8784
imageWithColor.source_files = "RKOTools/ImageWithColor/*.{h,m}"
8885
end
8986

90-
# end
91-
9287
end

RKOTools/RKOCell/RKOCell.h

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// RKOCell.h
3+
// Summary01_Rakuyo
4+
//
5+
// Created by Rakuyo on 2017/8/14.
6+
// Copyright © 2017年 Rakuyo. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface RKOCell : UITableViewCell
12+
13+
/**
14+
快速获取 cell
15+
16+
@param tableView 当前的tableView
17+
@return 一个普通的cell
18+
*/
19+
+ (instancetype)cell:(UITableView *)tableView;
20+
21+
/**
22+
从xib中获取cell
23+
24+
@param tableView 当前的tableView
25+
@return 从xib中获取到的cell
26+
*/
27+
+ (instancetype)xibCell:(UITableView *)tableView;
28+
29+
/**
30+
获取一个空白的cell
31+
32+
@param tableView 当前的tableView
33+
@return 一个空白的cell
34+
*/
35+
+ (id)blankCell:(UITableView *)tableView;
36+
37+
@end
38+

RKOTools/RKOCell/RKOCell.m

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// RKOCell.m
3+
// Summary01_Rakuyo
4+
//
5+
// Created by Rakuyo on 2017/8/14.
6+
// Copyright © 2017年 Rakuyo. All rights reserved.
7+
//
8+
9+
#import "RKOCell.h"
10+
11+
@implementation RKOCell
12+
13+
// 快速获取 cell
14+
+ (instancetype)cell:(UITableView *)tableView {
15+
NSString *ID = NSStringFromClass(self);
16+
RKOCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
17+
18+
if (!cell) {
19+
[tableView registerClass:self forCellReuseIdentifier:ID];
20+
cell = [tableView dequeueReusableCellWithIdentifier:ID];
21+
}
22+
23+
return cell;
24+
}
25+
26+
// 从xib中获取cell
27+
+ (instancetype)xibCell:(UITableView *)tableView {
28+
NSString *ID = NSStringFromClass(self);
29+
RKOCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
30+
31+
if (!cell) {
32+
[tableView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellReuseIdentifier:ID];
33+
cell = [tableView dequeueReusableCellWithIdentifier:ID];
34+
}
35+
36+
return cell;
37+
}
38+
39+
// 获取一个空白的cell
40+
+ (id)blankCell:(UITableView*)tableView {
41+
static NSString *const ID = @"RKOBlanckCellID";
42+
43+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
44+
if (!cell) {
45+
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:ID];
46+
cell = [tableView dequeueReusableCellWithIdentifier:ID];
47+
}
48+
return cell;
49+
}
50+
51+
@end

0 commit comments

Comments
 (0)