Skip to content

Commit b6c5368

Browse files
committed
add YAResableCell func
1 parent be9765d commit b6c5368

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// UITableView+YAReusableCell.h
3+
//
4+
//
5+
// Created by liuyan on 6/12/15.
6+
//
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface UITableView (YAReusableCell)
12+
13+
- (id)dequeueReusableCellWithClass:(Class)aClass;
14+
- (void)registerReuseCellClass:(Class)cellClass;
15+
16+
- (id)dequeueReusableHeaderFooterViewWithClass:(Class)aClass;
17+
- (void)registerReuseHeaderFooterClass:(Class)aClass;
18+
19+
@end
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// UITableView+YAReusableCell.m
3+
//
4+
//
5+
// Created by liuyan on 6/12/15.
6+
//
7+
//
8+
9+
#import "UITableView+YAReusableCell.h"
10+
11+
@implementation UITableView (YAReusableCell)
12+
13+
- (void)registerReuseCellClass:(Class)cellClass
14+
{
15+
[self registerClass:cellClass forCellReuseIdentifier:NSStringFromClass(cellClass)];
16+
}
17+
18+
- (id)dequeueReusableCellWithClass:(Class)aClass
19+
{
20+
return [self dequeueReusableCellWithIdentifier:NSStringFromClass(aClass)];
21+
}
22+
23+
- (void)registerReuseHeaderFooterClass:(Class)aClass
24+
{
25+
return [self registerClass:aClass forHeaderFooterViewReuseIdentifier:NSStringFromClass(aClass)];
26+
}
27+
28+
- (id)dequeueReusableHeaderFooterViewWithClass:(Class)aClass
29+
{
30+
return [self dequeueReusableHeaderFooterViewWithIdentifier:NSStringFromClass(aClass)];
31+
}
32+
33+
@end

Source/YAUIKit.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import "UIColor+YAHexColor.h"
1616

1717
#import "UIView+YAUIKit.h"
18+
#import "UITableView+YAReusableCell.h"
1819

1920
#import "UINavigationController+YAAnimation.h"
2021

@@ -30,7 +31,7 @@
3031

3132
#import "UIApplication+YAKeyboardWindow.h"
3233

33-
//Custom View
34+
// Custom View
3435

3536
#import "YAPanBackController.h"
3637
#import "YAPanController.h"

YAUIKit/YAUIKit.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
75900D4819E445E500C05D28 /* YASkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 75900D4719E445E500C05D28 /* YASkinManager.m */; };
8989
75900D4C19E448F100C05D28 /* YATableDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 75900D4B19E448F100C05D28 /* YATableDataSource.m */; };
9090
75C15C2419EA70AA00E5C341 /* UIApplication+YAKeyboardWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 75C15C2319EA70AA00E5C341 /* UIApplication+YAKeyboardWindow.m */; };
91+
75F9D1321B2A8DF800972CB5 /* UITableView+YAReusableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 75F9D1311B2A8DF800972CB5 /* UITableView+YAReusableCell.m */; };
9192
/* End PBXBuildFile section */
9293

9394
/* Begin PBXContainerItemProxy section */
@@ -214,6 +215,8 @@
214215
75900D4B19E448F100C05D28 /* YATableDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YATableDataSource.m; sourceTree = "<group>"; };
215216
75C15C2219EA70AA00E5C341 /* UIApplication+YAKeyboardWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+YAKeyboardWindow.h"; sourceTree = "<group>"; };
216217
75C15C2319EA70AA00E5C341 /* UIApplication+YAKeyboardWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+YAKeyboardWindow.m"; sourceTree = "<group>"; };
218+
75F9D1301B2A8DF800972CB5 /* UITableView+YAReusableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+YAReusableCell.h"; sourceTree = "<group>"; };
219+
75F9D1311B2A8DF800972CB5 /* UITableView+YAReusableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+YAReusableCell.m"; sourceTree = "<group>"; };
217220
/* End PBXFileReference section */
218221

219222
/* Begin PBXFrameworksBuildPhase section */
@@ -475,6 +478,7 @@
475478
75900CEE19E4438E00C05D28 /* Extend */ = {
476479
isa = PBXGroup;
477480
children = (
481+
75C710881B2A8D7C00901AA7 /* UITableView */,
478482
75C15C2119EA709E00E5C341 /* UIApplication */,
479483
75900CEF19E4438E00C05D28 /* UIBarButtonItem */,
480484
75900CF219E4438E00C05D28 /* UIColor */,
@@ -655,6 +659,15 @@
655659
path = UIApplication;
656660
sourceTree = "<group>";
657661
};
662+
75C710881B2A8D7C00901AA7 /* UITableView */ = {
663+
isa = PBXGroup;
664+
children = (
665+
75F9D1301B2A8DF800972CB5 /* UITableView+YAReusableCell.h */,
666+
75F9D1311B2A8DF800972CB5 /* UITableView+YAReusableCell.m */,
667+
);
668+
path = UITableView;
669+
sourceTree = "<group>";
670+
};
658671
/* End PBXGroup section */
659672

660673
/* Begin PBXNativeTarget section */
@@ -804,6 +817,7 @@
804817
75900D4219E4438E00C05D28 /* YARefreshControl.m in Sources */,
805818
75900D3219E4438E00C05D28 /* UIFont+YAUIKit.m in Sources */,
806819
75900D4419E4438E00C05D28 /* YARefreshIndicator.m in Sources */,
820+
75F9D1321B2A8DF800972CB5 /* UITableView+YAReusableCell.m in Sources */,
807821
75900D3619E4438E00C05D28 /* UINavigationController+YAAnimation.m in Sources */,
808822
75900D3319E4438E00C05D28 /* UIImage+YAColor.m in Sources */,
809823
75900D4819E445E500C05D28 /* YASkinManager.m in Sources */,

0 commit comments

Comments
 (0)