-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to change 'sticky' and 'shadow' from option.
- Loading branch information
taglia
committed
Feb 16, 2016
1 parent
4f88f5e
commit 83e334a
Showing
20 changed files
with
660 additions
and
167 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
27 changes: 27 additions & 0 deletions
27
ElasticTransistionExample/Cell/CellDimensionAndTypeDelegate.h
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,27 @@ | ||
// | ||
// CellDimensionAndTypeDelegate.h | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
typedef NS_ENUM(int, PropertyRelated){ | ||
STICKY, | ||
SHADOW, | ||
RADIUS | ||
}; | ||
|
||
@protocol CellDimensionAndTypeDelegate | ||
|
||
@required | ||
@property (nonatomic) PropertyRelated type; | ||
@property (nonatomic) CGFloat rowHeigth; | ||
@property (nonatomic) NSString *name; | ||
|
||
@optional | ||
-(void)didChangeStateToOn:(BOOL)on; | ||
|
||
@end |
29 changes: 29 additions & 0 deletions
29
ElasticTransistionExample/Cell/CellModel/SwitchCellModel.h
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,29 @@ | ||
// | ||
// SwitchCellModel.h | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "CellDimensionAndTypeDelegate.h" | ||
|
||
@protocol CellStateChange; | ||
|
||
@interface SwitchCellModel : NSObject <CellDimensionAndTypeDelegate> | ||
|
||
@property (nonatomic) BOOL on; | ||
@property (nonatomic, weak) id<CellStateChange> delegate; | ||
|
||
- (void)setSwitchOn:(BOOL)on; | ||
|
||
@end | ||
|
||
|
||
@protocol CellStateChange <NSObject> | ||
|
||
@optional | ||
-(void)didChangeStateToOn:(BOOL)on AndPropertyRelated:(PropertyRelated)property; | ||
|
||
@end |
42 changes: 42 additions & 0 deletions
42
ElasticTransistionExample/Cell/CellModel/SwitchCellModel.m
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,42 @@ | ||
// | ||
// SwitchCellModel.m | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import "SwitchCellModel.h" | ||
|
||
@implementation SwitchCellModel | ||
|
||
@synthesize type, rowHeigth; | ||
@synthesize name; | ||
|
||
-(id)initWithName:(NSString*)aName AndOn:(BOOL)on{ | ||
|
||
self = [super init]; | ||
|
||
if(self){ | ||
|
||
self.rowHeigth = 54.0; | ||
self.name = aName; | ||
self.on = on; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)setSwitchOn:(BOOL)on{ | ||
|
||
self.on = on; | ||
|
||
id<CellStateChange> strongDelegate = self.delegate; | ||
|
||
if([strongDelegate respondsToSelector:@selector(didChangeStateToOn:AndPropertyRelated:)]){ | ||
|
||
[strongDelegate didChangeStateToOn:on AndPropertyRelated:self.type]; | ||
} | ||
} | ||
|
||
@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,21 @@ | ||
// | ||
// SegmentCell.h | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "CellDimensionAndTypeDelegate.h" | ||
|
||
@interface SegmentCell : UITableViewCell <CellDimensionAndTypeDelegate> | ||
|
||
@property (nonatomic) NSMutableArray *values; | ||
|
||
@property (nonatomic, weak) IBOutlet UILabel *nameLabel; | ||
@property (nonatomic, weak) IBOutlet UISegmentedControl *segment; | ||
|
||
-(IBAction)segmentChanged:(UISegmentedControl*)sender; | ||
|
||
@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,36 @@ | ||
// | ||
// SegmentCell.m | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import "SegmentCell.h" | ||
|
||
@implementation SegmentCell | ||
|
||
@synthesize type, rowHeigth; | ||
|
||
- (id)initWithCoder:(NSCoder *)aDecoder | ||
{ | ||
self = [super initWithCoder:aDecoder]; | ||
|
||
if (self) { | ||
|
||
self.rowHeigth = 72.0; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
-(void)onChangeValue:(id)value{ | ||
|
||
} | ||
|
||
-(IBAction)segmentChanged:(UISegmentedControl*)sender{ | ||
|
||
[self onChangeValue:self.values[sender.selectedSegmentIndex]]; | ||
} | ||
|
||
@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,19 @@ | ||
// | ||
// SliderCell.h | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "CellDimensionAndTypeDelegate.h" | ||
|
||
@interface SliderCell : UITableViewCell <CellDimensionAndTypeDelegate> | ||
|
||
@property (nonatomic, weak) IBOutlet UILabel *nameLabel; | ||
@property (nonatomic, weak) IBOutlet UISlider *slider; | ||
|
||
-(IBAction)sliderChanged:(UISlider*)sender; | ||
|
||
@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,36 @@ | ||
// | ||
// SliderCell.m | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import "SliderCell.h" | ||
|
||
@implementation SliderCell | ||
|
||
@synthesize type, rowHeigth; | ||
|
||
- (id)initWithCoder:(NSCoder *)aDecoder | ||
{ | ||
self = [super initWithCoder:aDecoder]; | ||
|
||
if (self) { | ||
|
||
self.rowHeigth = 62.0; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
-(IBAction)sliderChanged:(UISlider*)sender{ | ||
|
||
[self onChangeValue:sender.value]; | ||
} | ||
|
||
-(void)onChangeValue:(CGFloat)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,20 @@ | ||
// | ||
// SwitchCell.h | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "SwitchCellModel.h" | ||
|
||
@interface SwitchCell : UITableViewCell | ||
|
||
@property (nonatomic, weak) IBOutlet UILabel *nameLabel; | ||
@property (nonatomic, weak) IBOutlet UISwitch *control; | ||
@property (nonatomic, weak) SwitchCellModel *cellModel; | ||
|
||
-(IBAction)switchChanged:(UISwitch*)sender; | ||
|
||
@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,28 @@ | ||
// | ||
// SwitchCell.m | ||
// ElasticTransitionExample | ||
// | ||
// Created by Tigielle on 16/02/16. | ||
// Copyright © 2016 Matteo Tagliafico. All rights reserved. | ||
// | ||
|
||
#import "SwitchCell.h" | ||
|
||
@implementation SwitchCell | ||
|
||
@synthesize cellModel; | ||
|
||
- (void)setCellModel:(SwitchCellModel *)aCellModel{ | ||
|
||
self->cellModel = aCellModel; | ||
|
||
self.nameLabel.text = aCellModel.name; | ||
[self.control setOn:aCellModel.on]; | ||
} | ||
|
||
-(IBAction)switchChanged:(UISwitch*)sender{ | ||
|
||
[self.cellModel setSwitchOn:sender.on]; | ||
} | ||
|
||
@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
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
Oops, something went wrong.