Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
41
iphone/Maps/UI/Editor/Cells/MWMEditorSwitchTableViewCell.m
Normal file
41
iphone/Maps/UI/Editor/Cells/MWMEditorSwitchTableViewCell.m
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#import "MWMEditorSwitchTableViewCell.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
@interface MWMEditorSwitchTableViewCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIImageView * icon;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * label;
|
||||
@property(weak, nonatomic) IBOutlet UISwitch * switchControl;
|
||||
|
||||
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMEditorSwitchTableViewCell
|
||||
|
||||
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
|
||||
icon:(UIImage *)icon
|
||||
text:(NSString *)text
|
||||
on:(BOOL)on
|
||||
{
|
||||
self.delegate = delegate;
|
||||
self.icon.image = icon;
|
||||
self.icon.styleName = @"MWMBlack";
|
||||
self.label.text = text;
|
||||
self.switchControl.on = on;
|
||||
[self setTextColorWithSwitchValue:on];
|
||||
}
|
||||
|
||||
- (void)setTextColorWithSwitchValue:(BOOL)value
|
||||
{
|
||||
self.label.textColor = value ? [UIColor blackPrimaryText] : [UIColor blackHintText];
|
||||
}
|
||||
|
||||
- (IBAction)valueChanged
|
||||
{
|
||||
BOOL const value = self.switchControl.on;
|
||||
[self.delegate cell:self changeSwitch:value];
|
||||
[self setTextColorWithSwitchValue:value];
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue