forked from romaonthego/RETableViewManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7e06188
Showing
21 changed files
with
1,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.