Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
romaonthego committed Feb 28, 2013
0 parents commit 7e06188
Show file tree
Hide file tree
Showing 21 changed files with 1,182 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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.
38 changes: 38 additions & 0 deletions RETableViewManager/REBoolItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// REBoolItem.h
// RETableViewManager
//
// 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.
//

#import "RETableViewItem.h"

@interface REBoolItem : RETableViewItem

@property (assign, nonatomic) BOOL value;

+ (id)itemWithTitle:(NSString *)title value:(BOOL)value actionBlock:(void(^)(REBoolItem *item))actionBlock;
+ (id)itemWithTitle:(NSString *)title value:(BOOL)value;

- (id)initWithTitle:(NSString *)title value:(BOOL)value actionBlock:(void(^)(REBoolItem *item))actionBlock;
- (id)initWithTitle:(NSString *)title value:(BOOL)value;

@end
58 changes: 58 additions & 0 deletions RETableViewManager/REBoolItem.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// REBoolItem.m
// RETableViewManager
//
// 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.
//

#import "REBoolItem.h"

@implementation REBoolItem

+ (id)itemWithTitle:(NSString *)title value:(BOOL)value
{
return [[REBoolItem alloc] initWithTitle:title value:value];
}

+ (id)itemWithTitle:(NSString *)title value:(BOOL)value actionBlock:(void(^)(REBoolItem *item))actionBlock
{
return [[REBoolItem alloc] initWithTitle:title value:value actionBlock:actionBlock];
}

- (id)initWithTitle:(NSString *)title value:(BOOL)value
{
return [self initWithTitle:title value:value actionBlock:nil];
}

- (id)initWithTitle:(NSString *)title value:(BOOL)value actionBlock:(void(^)(REBoolItem *item))actionBlock
{
self = [super init];
if (!self)
return nil;

self.title = title;
self.value = value;
self.actionBlock = actionBlock;

return self;
}

@end
38 changes: 38 additions & 0 deletions RETableViewManager/REStringItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// REStringItem.h
// RETableViewManager
//
// 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.
//

#import "RETableViewItem.h"

@interface REStringItem : RETableViewItem

@property (assign, nonatomic) UITableViewCellAccessoryType accessoryType;
@property (strong, nonatomic) UIView *accessoryView;

+ (id)itemWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType;
+ (id)itemWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType accessoryView:(UIView *)accessoryView;
- (id)initWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType;
- (id)initWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType accessoryView:(UIView *)accessoryView;

@end
60 changes: 60 additions & 0 deletions RETableViewManager/REStringItem.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// REStringItem.m
// RETableViewManager
//
// 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.
//

#import "REStringItem.h"

@implementation REStringItem

+ (id)itemWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType
{
return [[REStringItem alloc] initWithTitle:title actionBlock:actionBlock accessoryType:accessoryType accessoryView:nil];
}

+ (id)itemWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType accessoryView:(UIView *)accessoryView
{
return [[REStringItem alloc] initWithTitle:title actionBlock:actionBlock accessoryType:accessoryType accessoryView:accessoryView];
}

- (id)initWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType;
{
return [self initWithTitle:title actionBlock:actionBlock accessoryType:accessoryType accessoryView:nil];
}

- (id)initWithTitle:(NSString *)title actionBlock:(void(^)(RETableViewItem *item))actionBlock accessoryType:(UITableViewCellAccessoryType)accessoryType accessoryView:(UIView *)accessoryView
{
self = [super init];
if (!self)
return nil;

self.title = title;
self.accessoryType = accessoryType;
self.accessoryView = accessoryView;
self.actionBlock = actionBlock;
self.performActionOnSelection = YES;

return self;
}

@end
35 changes: 35 additions & 0 deletions RETableViewManager/RETableViewBoolCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// RETableViewBoolCell.h
// RETableViewManager
//
// 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.
//

#import "RETableViewCell.h"
#import "REBoolItem.h"

@interface RETableViewBoolCell : RETableViewCell {
UISwitch *_switch;
}

@property (strong, nonatomic) REBoolItem *item;

@end
58 changes: 58 additions & 0 deletions RETableViewManager/RETableViewBoolCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// RETableViewBoolCell.m
// RETableViewManager
//
// 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.
//

#import "RETableViewBoolCell.h"

@implementation RETableViewBoolCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
_switch = [[UISwitch alloc] init];
[_switch addTarget:self action:@selector(switchValueDidChanged:) forControlEvents:UIControlEventValueChanged];
self.accessoryView = _switch;
}
return self;
}

- (void)prepare
{
self.textLabel.text = self.item.title;
_switch.on = self.item.value;
}

#pragma mark -
#pragma mark UISwitch events

- (void)switchValueDidChanged:(UISwitch *)switchView
{
self.item.value = switchView.isOn;
if (self.item.actionBlock)
self.item.actionBlock(self.item);
}

@end
40 changes: 40 additions & 0 deletions RETableViewManager/RETableViewCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// RETableViewCell.h
// RETableViewManager
//
// 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.
//

#import <UIKit/UIKit.h>
#import "RETableViewSection.h"

@interface RETableViewCell : UITableViewCell

@property (assign, nonatomic) NSInteger row;
@property (assign, nonatomic) NSInteger sectionIndex;
@property (weak, nonatomic) UITableView *parentTableView;
@property (weak, nonatomic) RETableViewSection *section;
@property (strong, nonatomic) NSObject *item;

- (void)prepare;
+ (CGFloat)height;

@end
40 changes: 40 additions & 0 deletions RETableViewManager/RETableViewCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// RETableViewCell.m
// RETableViewManager
//
// 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.
//

#import "RETableViewCell.h"

@implementation RETableViewCell

+ (CGFloat)height
{
return 44;
}

- (void)prepare
{

}

@end
Loading

0 comments on commit 7e06188

Please sign in to comment.