Use RETableViewItem as base item class

This commit is contained in:
Roman Efimov
2013-04-04 15:55:19 -05:00
parent 82fd965b7b
commit df4ea9e104
6 changed files with 9 additions and 10 deletions

View File

@@ -27,6 +27,4 @@
@interface RETableViewStringCell : RETableViewCell
@property (strong, readwrite, nonatomic) NSString *item;
@end

View File

@@ -41,7 +41,7 @@
- (void)prepare
{
if ([self.item isKindOfClass:[NSString class]]) {
self.textLabel.text = self.item;
self.textLabel.text = (NSString *)self.item;
} else {
RETableViewItem *item = (RETableViewItem *)self.item;
self.textLabel.text = item.title;

View File

@@ -28,6 +28,7 @@
#import "REActionBar.h"
@class RETableViewManager;
@class RETableViewItem;
@interface RETableViewCell : UITableViewCell <REActionBarDelegate>
@@ -37,7 +38,7 @@
@property (weak, readwrite, nonatomic) UITableView *parentTableView;
@property (weak, readwrite, nonatomic) RETableViewManager *tableViewManager;
@property (weak, readwrite, nonatomic) RETableViewSection *section;
@property (strong, readwrite, nonatomic) NSObject *item;
@property (strong, readwrite, nonatomic) RETableViewItem *item;
@property (strong, readwrite, nonatomic) REActionBar *actionBar;
+ (CGFloat)heightWithItem:(NSObject *)item tableViewManager:(RETableViewManager *)tableViewManager;

View File

@@ -31,15 +31,15 @@
@interface RETableViewItem : NSObject
@property (copy, readwrite, nonatomic) NSString *title;
@property (copy, readwrite, nonatomic) void (^actionBlock)(id item);
@property (copy, readwrite, nonatomic) void (^accessoryButtonActionBlock)(id item);
@property (weak, readwrite, nonatomic) RETableViewSection *section;
@property (assign, readwrite, nonatomic) BOOL performActionOnSelection;
@property (assign, readonly, nonatomic) BOOL canFocus;
@property (weak, readwrite, nonatomic) RETableViewSection *section;
@property (copy, readwrite, nonatomic) NSString *detailLabelText;
@property (assign, readwrite, nonatomic) UITableViewCellStyle cellStyle;
@property (assign, readwrite, nonatomic) UITableViewCellAccessoryType accessoryType;
@property (strong, readwrite, nonatomic) UIView *accessoryView;
@property (copy, readwrite, nonatomic) void (^actionBlock)(id item);
@property (copy, readwrite, nonatomic) void (^accessoryButtonActionBlock)(id item);
+ (id)item;
+ (id)itemWithTitle:(NSString *)title accessoryType:(UITableViewCellAccessoryType)accessoryType actionBlock:(void(^)(RETableViewItem *item))actionBlock;

View File

@@ -103,7 +103,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
RETableViewSection *section = [_sections objectAtIndex:indexPath.section];
NSObject *item = [section.items objectAtIndex:indexPath.row];
RETableViewItem *item = [section.items objectAtIndex:indexPath.row];
UITableViewCellStyle cellStyle = UITableViewCellStyleDefault;
if ([item isKindOfClass:[RETableViewItem class]])

View File

@@ -217,10 +217,10 @@
30DB065616E934AD006C9530 /* RECreditCardItem.m */,
30DB065716E934AD006C9530 /* RENumberItem.h */,
30DB065816E934AD006C9530 /* RENumberItem.m */,
30DB065B16E934AD006C9530 /* RETextItem.h */,
30DB065C16E934AD006C9530 /* RETextItem.m */,
30F41319170E0F620004EBAE /* RERadioItem.h */,
30F4131A170E0F620004EBAE /* RERadioItem.m */,
30DB065B16E934AD006C9530 /* RETextItem.h */,
30DB065C16E934AD006C9530 /* RETextItem.m */,
);
path = Items;
sourceTree = "<group>";