Skip to content

Commit 9a61c4c

Browse files
author
Diogo Autilio
committed
Add UI_APPEARANCE_SELECTOR to SCLSwitchView
Code formatting Update SCLSwitchView example
1 parent bcc23c6 commit 9a61c4c

4 files changed

Lines changed: 25 additions & 16 deletions

File tree

SCLAlertView/SCLSwitchView.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
@interface SCLSwitchView : UIView
1616

17-
@property (strong, nonatomic) UIColor *tintColor;
18-
@property (strong, nonatomic) UIColor *labelColor;
19-
@property (strong, nonatomic) UIFont *labelFont;
20-
@property (strong, nonatomic) NSString *labelText;
17+
@property (strong, nonatomic) UIColor *tintColor UI_APPEARANCE_SELECTOR;
18+
@property (strong, nonatomic) UIColor *labelColor UI_APPEARANCE_SELECTOR;
19+
@property (strong, nonatomic) UIFont *labelFont UI_APPEARANCE_SELECTOR;
20+
@property (strong, nonatomic) NSString *labelText UI_APPEARANCE_SELECTOR;
2121
@property (nonatomic, getter=isSelected) BOOL selected;
2222

2323
@end

SCLAlertView/SCLSwitchView.m

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,41 +85,50 @@ - (void)setup
8585

8686
#pragma mark - Getters
8787

88-
- (UIColor *)tintColor {
88+
- (UIColor *)tintColor
89+
{
8990
return self.switchKnob.tintColor;
9091
}
9192

92-
- (UIColor *)labelColor {
93+
- (UIColor *)labelColor
94+
{
9395
return self.switchLabel.textColor;
9496
}
9597

96-
- (UIFont *)labelFont {
98+
- (UIFont *)labelFont
99+
{
97100
return self.switchLabel.font;
98101
}
99102

100-
- (NSString *)labelText {
103+
- (NSString *)labelText
104+
{
101105
return self.switchLabel.text;
102106
}
103107

104-
- (BOOL)isSelected {
108+
- (BOOL)isSelected
109+
{
105110
return self.switchKnob.isOn;
106111
}
107112

108113
#pragma mark - Setters
109114

110-
- (void)setTintColor:(UIColor *)tintColor {
115+
- (void)setTintColor:(UIColor *)tintColor
116+
{
111117
self.switchKnob.onTintColor = tintColor;
112118
}
113119

114-
- (void)setLabelColor:(UIColor *)labelColor {
120+
- (void)setLabelColor:(UIColor *)labelColor
121+
{
115122
self.switchLabel.textColor = labelColor;
116123
}
117124

118-
- (void)setLabelFont:(UIFont *)labelFont {
125+
- (void)setLabelFont:(UIFont *)labelFont
126+
{
119127
self.switchLabel.font = labelFont;
120128
}
121129

122-
- (void)setLabelText:(NSString *)labelText {
130+
- (void)setLabelText:(NSString *)labelText
131+
{
123132
self.switchLabel.text = labelText;
124133
}
125134

SCLAlertView/SCLTimerDisplay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif
1515
#import "SCLButton.h"
1616

17-
@interface SCLTimerDisplay : UIView{
17+
@interface SCLTimerDisplay : UIView {
1818
CGFloat currentAngle;
1919
CGFloat currentTime;
2020
CGFloat timerLimit;

SCLAlertViewExample/ViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ - (IBAction)showSwitch:(id)sender {
426426
alert.useLargerIcon = YES;
427427
alert.cornerRadius = 13.0f;
428428

429-
SCLSwitchView *switchView = [alert addSwitchViewWithLabel:@"Don't show again".uppercaseString];
430-
switchView.tintColor = [UIColor brownColor];
429+
[alert addSwitchViewWithLabel:@"Don't show again".uppercaseString];
430+
[[SCLSwitchView appearance] setTintColor:[UIColor redColor]];
431431

432432
SCLButton *button = [alert addButton:@"Done" target:self selector:@selector(firstButton)];
433433

0 commit comments

Comments
 (0)