Files
Ilya Laktyushin bae6e9a1d2 Initial commit
2018-07-26 15:04:25 +03:00

44 lines
879 B
Objective-C

#import "ScopeCell.h"
NSString *const ComplexScopeCellIdentifier = @"ComplexScopeCell";
NSString *const SwitchableScopeCellIdentifier = @"SwitchableScopeCell";
@implementation ScopeCell
- (void)setScope:(Scope *)scope {
}
+ (NSString *)identifier {
return NSStringFromClass([self class]);
}
@end
@implementation ComplexScopeCell
- (void)setScope:(ComplexScope *)scope {
self.textLabel.text = scope.title;
}
@end
@implementation SwitchableScopeCell
- (void)awakeFromNib {
[super awakeFromNib];
[self.switchView addTarget:self action:@selector(switchChanged) forControlEvents:UIControlEventValueChanged];
}
- (void)switchChanged {
if (self.valueChanged != nil)
self.valueChanged(self.switchView.isOn);
}
- (void)setScope:(SwitchableScope *)scope {
self.titleLabel.text = scope.title;
self.switchView.on = scope.enabled;
}
@end