Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
Little refactoring in YXAbstractCell
Browse files Browse the repository at this point in the history
  • Loading branch information
rbsgn committed Jul 19, 2010
1 parent 8050632 commit 1e9bd2d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
12 changes: 7 additions & 5 deletions Classes/YXAbstractCell.h
@@ -1,5 +1,5 @@
//
// YXCell.h
// YXAbstractCell.h
// YXModelTableViews
//
// Created by Mikhail Kalugin on 5/11/10.
Expand All @@ -10,13 +10,15 @@


@interface YXAbstractCell : NSObject {
NSString * _reuseIdentifier;
@protected
NSString * reuseIdentifier_;
}
@property (nonatomic, copy) NSString *reuseIdentifier;

- (id)initWithReuseIdentifier:(NSString*)reuseIdentifier;
@property (nonatomic, readonly) NSString * reuseIdentifier;

- (UITableViewCell*)tableViewCellWithReusableCell:(UITableViewCell*)reusableCell;
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;

- (UITableViewCell *)tableViewCellWithReusableCell:(UITableViewCell *)reusableCell;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath;
Expand Down
37 changes: 27 additions & 10 deletions Classes/YXAbstractCell.m
@@ -1,5 +1,5 @@
//
// YXCell.m
// YXAbstractCell.m
// YXModelTableViews
//
// Created by Mikhail Kalugin on 5/11/10.
Expand All @@ -11,22 +11,25 @@

@implementation YXAbstractCell

@synthesize reuseIdentifier = _reuseIdentifier;

- (void)dealloc {
self.reuseIdentifier = nil;
#pragma mark -
#pragma mark Object lifecycle

[super dealloc];
}

- (id)initWithReuseIdentifier:(NSString*)reuseIdentifier {
if (self = [super init]) {
self.reuseIdentifier = reuseIdentifier;
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
self = [super init];
if (self) {
reuseIdentifier_ = [reuseIdentifier copy];
}
return self;
}

- (UITableViewCell*)tableViewCellWithReusableCell:(UITableViewCell*)reusableCell {

#pragma mark -
#pragma mark Public interface


- (UITableViewCell *)tableViewCellWithReusableCell:(UITableViewCell *)reusableCell {
@throw @"abstract method";
}

Expand All @@ -39,4 +42,18 @@ - (void)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
}


#pragma mark -
#pragma mark Memory management


@synthesize reuseIdentifier = reuseIdentifier_;


- (void)dealloc {
[reuseIdentifier_ release];

[super dealloc];
}

@end

0 comments on commit 1e9bd2d

Please sign in to comment.