Skip to content

Commit cea01c2

Browse files
committed
Reverted Liquid Glass support
1 parent fe0a17c commit cea01c2

2 files changed

Lines changed: 5 additions & 26 deletions

File tree

TOSegmentedControl/TOSegmentedControl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ IB_DESIGNABLE @interface TOSegmentedControl : UIControl
6363
/// Set the background color of the track in the segmented control (Default is light grey)
6464
@property (nonatomic, strong, null_resettable) IBInspectable UIColor *backgroundColor;
6565

66-
/// Alternatively, set a background material that will be used instead of a solid color. (eg Liquid Glass)
67-
@property (nonatomic, strong, null_resettable) UIVisualEffect *backgroundEffect;
68-
6966
/// Set the color of the thumb view. (Default is white)
7067
@property (nonatomic, strong, null_resettable) IBInspectable UIColor *thumbColor;
7168

TOSegmentedControl/TOSegmentedControl.m

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ @interface TOSegmentedControl () <UIPointerInteractionDelegate>
6565
@property (nonatomic, assign) NSInteger focusedIndex;
6666

6767
/** The background rounded "track" view */
68-
@property (nonatomic, strong) UIVisualEffectView *trackView;
68+
@property (nonatomic, strong) UIView *trackView;
6969

7070
/** The view that shows which view is highlighted */
7171
@property (nonatomic, strong) UIView *thumbView;
@@ -135,7 +135,7 @@ - (instancetype)init {
135135

136136
- (void)commonInit {
137137
// Create content view
138-
self.trackView = [[UIVisualEffectView alloc] initWithFrame:self.bounds];
138+
self.trackView = [[UIView alloc] initWithFrame:self.bounds];
139139
self.trackView.autoresizingMask =
140140
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
141141
self.trackView.layer.masksToBounds = YES;
@@ -146,7 +146,7 @@ - (void)commonInit {
146146
// Create thumb view
147147
self.thumbView = [[UIView alloc] initWithFrame:CGRectMake(2.0f, 2.0f, 100.0f, 28.0f)];
148148
self.thumbView.layer.shadowColor = [UIColor blackColor].CGColor;
149-
[self.trackView.contentView addSubview:self.thumbView];
149+
[self.trackView addSubview:self.thumbView];
150150

151151
// Create list for managing each item
152152
self.segments = [NSMutableArray array];
@@ -239,7 +239,7 @@ - (void)updateSeparatorViewCount {
239239
while (self.separatorViews.count < numberOfSeparators) {
240240
UIImageView *separator = [[UIImageView alloc] initWithImage:self.separatorImage];
241241
separator.tintColor = self.separatorColor;
242-
[self.trackView.contentView insertSubview:separator atIndex:0];
242+
[self.trackView insertSubview:separator atIndex:0];
243243
[self.separatorViews addObject:separator];
244244
}
245245

@@ -560,7 +560,7 @@ - (void)layoutItemViews {
560560
for (TOSegmentedControlSegment *item in self.segments) {
561561
UIView *itemView = item.itemView;
562562
[itemView sizeToFit];
563-
[self.trackView.contentView addSubview:item.containerView];
563+
[self.trackView addSubview:item.containerView];
564564

565565
// Get the container frame that the item will be aligned with
566566
CGRect thumbFrame = [self frameForSegmentAtIndex:i];
@@ -1363,24 +1363,6 @@ - (UIColor *)backgroundColor {
13631363
return self.trackView.backgroundColor;
13641364
}
13651365

1366-
// -----------------------------------------------
1367-
1368-
- (void)setBackgroundEffect:(UIVisualEffect *)effect {
1369-
_trackView.backgroundColor = nil;
1370-
_trackView.effect = effect;
1371-
1372-
// Exit out if we don't need to reset to defaults
1373-
if (_trackView.effect != nil) {
1374-
return;
1375-
}
1376-
1377-
// If we nil out the effect, restore the original background color
1378-
self.backgroundColor = nil;
1379-
}
1380-
- (UIVisualEffect *)backgroundEffect {
1381-
return self.trackView.effect;
1382-
}
1383-
13841366
// -----------------------------------------------
13851367
// Separator Color
13861368

0 commit comments

Comments
 (0)