Files
comaps/iphone/Maps/UI/Editor/Cells/MWMEditorSwitchTableViewCell.m
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

42 lines
1.1 KiB
Objective-C

#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