Refactor bunch of code, add cellDidLoad method

This commit is contained in:
Roman Efimov
2013-04-04 17:18:56 -05:00
parent f10578a2f0
commit a4c0d3cf67
13 changed files with 145 additions and 216 deletions

View File

@@ -27,18 +27,24 @@
@implementation RETableViewBoolCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
_switchView = [[UISwitch alloc] init];
[_switchView addTarget:self action:@selector(switchValueDidChanged:) forControlEvents:UIControlEventValueChanged];
self.accessoryView = _switchView;
}
return self;
}
- (void)cellDidLoad
{
[super cellDidLoad];
_switchView = [[UISwitch alloc] init];
[_switchView addTarget:self action:@selector(switchValueDidChanged:) forControlEvents:UIControlEventValueChanged];
self.accessoryView = _switchView;
}
- (void)prepare
{
self.textLabel.text = self.item.title;

View File

@@ -28,7 +28,7 @@
@implementation RETableViewCreditCardCell
static inline NSString *RECreditCardType(NSString *creditCardNumber)
static inline NSString * RECreditCardType(NSString *creditCardNumber)
{
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\D" options:NSRegularExpressionCaseInsensitive error:NULL];
NSString *strippedNumber = [regex stringByReplacingMatchesInString:creditCardNumber options:0 range:NSMakeRange(0, creditCardNumber.length) withTemplate:@""];
@@ -46,67 +46,73 @@ static inline NSString *RECreditCardType(NSString *creditCardNumber)
return nil;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.textLabel.backgroundColor = [UIColor clearColor];
_creditCardImageViewContainer = [[UIView alloc] initWithFrame:CGRectMake(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 20 : 56, 5, 32, 32)];
[self addSubview:_creditCardImageViewContainer];
_creditCardStackImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardStackImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Stack"];
_creditCardStackImageView.tag = 0;
_currentImageView = _creditCardStackImageView;
[_creditCardImageViewContainer addSubview:_creditCardStackImageView];
_creditCardImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Visa"];
_creditCardImageView.tag = 1;
_creditCardBackImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardBackImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Back"];
_creditCardBackImageView.tag = 2;
_wrapperView = [[UIView alloc] initWithFrame:CGRectMake(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 60 : 96 + _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 70, self.frame.size.height)];
_wrapperView.clipsToBounds = YES;
[self addSubview:_wrapperView];
_creditCardField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(0, 0, 216, self.frame.size.height - _textFieldPositionOffset.height)];
_creditCardField.tag = 0;
_creditCardField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_creditCardField.inputAccessoryView = self.actionBar;
_creditCardField.delegate = self;
_creditCardField.placeholder = @"1234 1234 1234 1234";
_creditCardField.format = @"XXXX XXXX XXXX XXXX";
[_creditCardField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_creditCardField];
_expirationDateField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(320, 0, 80, self.frame.size.height)];
_expirationDateField.tag = 1;
_expirationDateField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_expirationDateField.inputAccessoryView = self.actionBar;
_expirationDateField.format = @"XX/XX";
_expirationDateField.placeholder = @"MM/YY";
_expirationDateField.delegate = self;
[_expirationDateField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_expirationDateField];
_cvvField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(320, 0, 60, self.frame.size.height)];
_cvvField.tag = 2;
_cvvField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_cvvField.inputAccessoryView = self.actionBar;
_cvvField.format = @"XXX";
_cvvField.placeholder = @"CVV";
_cvvField.delegate = self;
[_cvvField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_cvvField];
}
return self;
}
- (void)cellDidLoad
{
[super cellDidLoad];
_creditCardImageViewContainer = [[UIView alloc] initWithFrame:CGRectMake(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 20 : 56, 5, 32, 32)];
[self addSubview:_creditCardImageViewContainer];
_creditCardStackImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardStackImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Stack"];
_creditCardStackImageView.tag = 0;
_currentImageView = _creditCardStackImageView;
[_creditCardImageViewContainer addSubview:_creditCardStackImageView];
_creditCardImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Visa"];
_creditCardImageView.tag = 1;
_creditCardBackImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
_creditCardBackImageView.image = [UIImage imageNamed:@"RETableViewManager.bundle/Card_Back"];
_creditCardBackImageView.tag = 2;
_wrapperView = [[UIView alloc] initWithFrame:CGRectMake(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 60 : 96 + _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 70, self.frame.size.height)];
_wrapperView.clipsToBounds = YES;
[self addSubview:_wrapperView];
_creditCardField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(0, 0, 216, self.frame.size.height - _textFieldPositionOffset.height)];
_creditCardField.tag = 0;
_creditCardField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_creditCardField.inputAccessoryView = self.actionBar;
_creditCardField.delegate = self;
_creditCardField.placeholder = @"1234 1234 1234 1234";
_creditCardField.format = @"XXXX XXXX XXXX XXXX";
[_creditCardField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_creditCardField];
_expirationDateField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(320, 0, 80, self.frame.size.height)];
_expirationDateField.tag = 1;
_expirationDateField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_expirationDateField.inputAccessoryView = self.actionBar;
_expirationDateField.format = @"XX/XX";
_expirationDateField.placeholder = @"MM/YY";
_expirationDateField.delegate = self;
[_expirationDateField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_expirationDateField];
_cvvField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(320, 0, 60, self.frame.size.height)];
_cvvField.tag = 2;
_cvvField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_cvvField.inputAccessoryView = self.actionBar;
_cvvField.format = @"XXX";
_cvvField.placeholder = @"CVV";
_cvvField.delegate = self;
[_cvvField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[_wrapperView addSubview:_cvvField];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];

View File

@@ -1,36 +1,18 @@
//
// RETableViewNumberCell.h
// RETableViewManager
// RETableViewNumberCell.h
// RETableViewManagerExample
//
// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Created by Roman Efimov on 4/4/13.
// Copyright (c) 2013 Roman Efimov. All rights reserved.
//
#import "RETableViewCell.h"
#import "RETableViewTextCell.h"
#import "REFormattedNumberField.h"
#import "RENumberItem.h"
@interface RETableViewNumberCell : RETableViewCell <UITextFieldDelegate>
@interface RETableViewNumberCell : RETableViewTextCell
@property (strong, readwrite, nonatomic) RENumberItem *item;
@property (strong, readwrite, nonatomic) REFormattedNumberField *textField;
@property (assign, readwrite, nonatomic) CGSize textFieldPositionOffset;
@end

View File

@@ -1,26 +1,9 @@
//
// RETableViewNumberCell.m
// RETableViewManager
// RETableViewNumberCell.m
// RETableViewManagerExample
//
// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Created by Roman Efimov on 4/4/13.
// Copyright (c) 2013 Roman Efimov. All rights reserved.
//
#import "RETableViewNumberCell.h"
@@ -28,33 +11,27 @@
@implementation RETableViewNumberCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.textLabel.backgroundColor = [UIColor clearColor];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
_textField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(140, 0, self.frame.size.width - 160, self.frame.size.height)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
_textField = [[REFormattedNumberField alloc] initWithFrame:CGRectMake(160, 0, self.frame.size.width - 200, self.frame.size.height)];
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_textField.inputAccessoryView = self.actionBar;
_textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_textField.delegate = self;
[_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[self addSubview:_textField];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
- (void)cellDidLoad
{
[super setSelected:selected animated:animated];
if (selected) {
[_textField becomeFirstResponder];
}
[super cellDidLoad];
self.textField = [[REFormattedNumberField alloc] initWithFrame:CGRectNull];
self.textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
self.textField.inputAccessoryView = self.actionBar;
self.textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.textField.delegate = self;
[self.textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[self addSubview:self.textField];
}
- (void)prepare
@@ -62,61 +39,13 @@
[super prepare];
self.textLabel.text = self.item.title;
_textField.text = self.item.value;
_textField.placeholder = self.item.placeholder;
_textField.format = self.item.format;
_textField.font = self.tableViewManager.style.textFieldFont;
_textFieldPositionOffset = self.tableViewManager.style.textFieldPositionOffset;
_textField.keyboardAppearance = self.item.keyboardAppearance;
}
- (UIResponder *)responder
{
return _textField;
}
- (void)layoutSubviews
{
[super layoutSubviews];
if (self.item.title) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
_textField.frame = CGRectMake(140 + _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 160, self.frame.size.height - _textFieldPositionOffset.height);
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
_textField.frame = CGRectMake(160+ _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 200, self.frame.size.height - _textFieldPositionOffset.height);
} else {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
_textField.frame = CGRectMake(20+ _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 40, self.frame.size.height - _textFieldPositionOffset.height);
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
_textField.frame = CGRectMake(40+ _textFieldPositionOffset.width, _textFieldPositionOffset.height, self.frame.size.width - 80, self.frame.size.height - _textFieldPositionOffset.height);
}
}
#pragma mark -
#pragma mark UISwitch events
- (void)textFieldDidChange:(UITextField *)textField
{
self.item.value = textField.text;
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
[self refreshActionBar];
[self.parentTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.row inSection:self.sectionIndex] atScrollPosition:UITableViewScrollPositionTop animated:YES];
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
NSIndexPath *indexPath = [self indexPathForNextResponder];
if (!indexPath) {
[self endEditing:YES];
return YES;
}
RETableViewCell *cell = (RETableViewCell *)[self.parentTableView cellForRowAtIndexPath:indexPath];
[cell.responder becomeFirstResponder];
return YES;
self.textField.text = self.item.value;
self.textField.placeholder = self.item.placeholder;
self.textField.format = self.item.format;
self.textField.font = self.tableViewManager.style.textFieldFont;
self.textFieldPositionOffset = self.tableViewManager.style.textFieldPositionOffset;
self.textField.keyboardAppearance = self.item.keyboardAppearance;
self.textField.keyboardType = UIKeyboardTypeNumberPad;
}
@end

View File

@@ -29,7 +29,7 @@
@interface RETableViewTextCell : RETableViewCell <UITextFieldDelegate>
@property (strong, readwrite, nonatomic) RETextItem *item;
@property (strong, readonly, nonatomic) UITextField *textField;
@property (strong, readwrite, nonatomic) UITextField *textField;
@property (assign, readwrite, nonatomic) CGSize textFieldPositionOffset;
@end

View File

@@ -28,24 +28,30 @@
@implementation RETableViewTextCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.textLabel.backgroundColor = [UIColor clearColor];
_textField = [[UITextField alloc] initWithFrame:CGRectNull];
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_textField.inputAccessoryView = self.actionBar;
_textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_textField.delegate = self;
[_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[self addSubview:_textField];
}
return self;
}
- (void)cellDidLoad
{
[super cellDidLoad];
_textField = [[UITextField alloc] initWithFrame:CGRectNull];
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_textField.inputAccessoryView = self.actionBar;
_textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_textField.delegate = self;
[_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
[self addSubview:_textField];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];

View File

@@ -25,17 +25,9 @@
#import "RETextItem.h"
@interface RENumberItem : RETableViewItem
@interface RENumberItem : RETextItem
// Data and values
//
@property (copy, readwrite, nonatomic) NSString *format;
@property (copy, readwrite, nonatomic) NSString *value;
@property (copy, readwrite, nonatomic) NSString *placeholder;
// Keyboard
//
@property (assign, readwrite, nonatomic) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault
+ (id)itemWithTitle:(NSString *)title value:(NSString *)value placeholder:(NSString *)placeholder format:(NSString *)format;
- (id)initWithTitle:(NSString *)title value:(NSString *)value placeholder:(NSString *)placeholder format:(NSString *)format;

View File

@@ -43,7 +43,7 @@
+ (CGFloat)heightWithItem:(NSObject *)item tableViewManager:(RETableViewManager *)tableViewManager;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager;
- (void)cellDidLoad;
- (void)prepare;
- (void)refreshActionBar;

View File

@@ -28,22 +28,27 @@
@implementation RETableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.tableViewManager = tableViewManager;
self.actionBar = [[REActionBar alloc] initWithDelegate:self];
if ([self hasCustomBackgroundImage]) {
self.backgroundView = [[UIView alloc] initWithFrame:self.contentView.bounds];
self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_backgroundImageView = [[UIImageView alloc] init];
[self.backgroundView addSubview:_backgroundImageView];
}
}
return self;
}
- (void)cellDidLoad
{
self.actionBar = [[REActionBar alloc] initWithDelegate:self];
if ([self hasCustomBackgroundImage]) {
self.backgroundView = [[UIView alloc] initWithFrame:self.contentView.bounds];
self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_backgroundImageView = [[UIImageView alloc] init];
[self.backgroundView addSubview:_backgroundImageView];
}
}
- (BOOL)hasCustomBackgroundImage
{
return [self.tableViewManager.style backgroundImageForCellType:RETableViewCellFirst] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellMiddle] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellLast] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellSingle];

View File

@@ -115,7 +115,9 @@
RETableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[cellClass alloc] initWithStyle:cellStyle reuseIdentifier:cellIdentifier tableViewManager:self];
cell = [[cellClass alloc] initWithStyle:cellStyle reuseIdentifier:cellIdentifier];
cell.tableViewManager = self;
[cell cellDidLoad];
}
cell.row = indexPath.row;

View File

@@ -15,7 +15,6 @@
302D2163170B27ED0085654F /* ListImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D2162170B27ED0085654F /* ListImageCell.m */; };
30DB066A16E934AD006C9530 /* RETableViewBoolCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB064916E934AD006C9530 /* RETableViewBoolCell.m */; };
30DB066B16E934AD006C9530 /* RETableViewCreditCardCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB064B16E934AD006C9530 /* RETableViewCreditCardCell.m */; };
30DB066C16E934AD006C9530 /* RETableViewNumberCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB064D16E934AD006C9530 /* RETableViewNumberCell.m */; };
30DB066E16E934AD006C9530 /* RETableViewTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB065116E934AD006C9530 /* RETableViewTextCell.m */; };
30DB066F16E934AD006C9530 /* REBoolItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB065416E934AD006C9530 /* REBoolItem.m */; };
30DB067016E934AD006C9530 /* RECreditCardItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB065616E934AD006C9530 /* RECreditCardItem.m */; };
@@ -39,6 +38,7 @@
30EF93C916E039B800B84981 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30EF93C816E039B800B84981 /* Default-568h@2x.png */; };
30F41318170E07BB0004EBAE /* RETableViewOptionsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F41317170E07BB0004EBAE /* RETableViewOptionsController.m */; };
30F4131B170E0F620004EBAE /* RERadioItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4131A170E0F620004EBAE /* RERadioItem.m */; };
30F4138E170E2E820004EBAE /* RETableViewNumberCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F4138D170E2E820004EBAE /* RETableViewNumberCell.m */; };
E336F792A48A4E779EEA5AC0 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABAE09A51FA5498F94EE3798 /* libPods.a */; };
/* End PBXBuildFile section */
@@ -59,8 +59,6 @@
30DB064916E934AD006C9530 /* RETableViewBoolCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewBoolCell.m; sourceTree = "<group>"; };
30DB064A16E934AD006C9530 /* RETableViewCreditCardCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RETableViewCreditCardCell.h; sourceTree = "<group>"; };
30DB064B16E934AD006C9530 /* RETableViewCreditCardCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewCreditCardCell.m; sourceTree = "<group>"; };
30DB064C16E934AD006C9530 /* RETableViewNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RETableViewNumberCell.h; sourceTree = "<group>"; };
30DB064D16E934AD006C9530 /* RETableViewNumberCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewNumberCell.m; sourceTree = "<group>"; };
30DB065016E934AD006C9530 /* RETableViewTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RETableViewTextCell.h; sourceTree = "<group>"; };
30DB065116E934AD006C9530 /* RETableViewTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewTextCell.m; sourceTree = "<group>"; };
30DB065316E934AD006C9530 /* REBoolItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REBoolItem.h; sourceTree = "<group>"; };
@@ -101,6 +99,8 @@
30F41317170E07BB0004EBAE /* RETableViewOptionsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewOptionsController.m; sourceTree = "<group>"; };
30F41319170E0F620004EBAE /* RERadioItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RERadioItem.h; sourceTree = "<group>"; };
30F4131A170E0F620004EBAE /* RERadioItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RERadioItem.m; sourceTree = "<group>"; };
30F4138C170E2E820004EBAE /* RETableViewNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RETableViewNumberCell.h; sourceTree = "<group>"; };
30F4138D170E2E820004EBAE /* RETableViewNumberCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewNumberCell.m; sourceTree = "<group>"; };
A20B0252928045F5B81B21AF /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
ABAE09A51FA5498F94EE3798 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -195,10 +195,10 @@
30DB064916E934AD006C9530 /* RETableViewBoolCell.m */,
30DB064A16E934AD006C9530 /* RETableViewCreditCardCell.h */,
30DB064B16E934AD006C9530 /* RETableViewCreditCardCell.m */,
30DB064C16E934AD006C9530 /* RETableViewNumberCell.h */,
30DB064D16E934AD006C9530 /* RETableViewNumberCell.m */,
30DB065016E934AD006C9530 /* RETableViewTextCell.h */,
30DB065116E934AD006C9530 /* RETableViewTextCell.m */,
30F4138C170E2E820004EBAE /* RETableViewNumberCell.h */,
30F4138D170E2E820004EBAE /* RETableViewNumberCell.m */,
);
path = Cells;
sourceTree = "<group>";
@@ -363,7 +363,6 @@
30EF93C316E039B800B84981 /* AppDelegate.m in Sources */,
30DB066A16E934AD006C9530 /* RETableViewBoolCell.m in Sources */,
30DB066B16E934AD006C9530 /* RETableViewCreditCardCell.m in Sources */,
30DB066C16E934AD006C9530 /* RETableViewNumberCell.m in Sources */,
30DB066E16E934AD006C9530 /* RETableViewTextCell.m in Sources */,
30DB066F16E934AD006C9530 /* REBoolItem.m in Sources */,
30DB067016E934AD006C9530 /* RECreditCardItem.m in Sources */,
@@ -383,6 +382,7 @@
302D2163170B27ED0085654F /* ListImageCell.m in Sources */,
30F41318170E07BB0004EBAE /* RETableViewOptionsController.m in Sources */,
30F4131B170E0F620004EBAE /* RERadioItem.m in Sources */,
30F4138E170E2E820004EBAE /* RETableViewNumberCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -71,6 +71,7 @@
section = [[RETableViewSection alloc] initWithHeaderTitle:@"Basic controls"];
[_manager addSection:section];
[section addItem:[RETextItem itemWithTitle:@"Text item 1" value:nil placeholder:@"Text"]];
[section addItem:[RENumberItem itemWithTitle:@"Phone" value:@"" placeholder:@"(123) 456-7890" format:@"(XXX) XXX-XXXX"]];
section = [[RETableViewSection alloc] initWithHeaderTitle:@"Credit card"];
[_manager addSection:section];

View File

@@ -16,9 +16,9 @@
return 306;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier tableViewManager:(RETableViewManager *)tableViewManager
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier tableViewManager:tableViewManager];
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_pictureView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 0, 306, 306)];
[self addSubview:_pictureView];