Skip to content

Commit b83fb67

Browse files
committed
修复侧边栏入口无法点击
1 parent 9ef30e2 commit b83fb67

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

DYYYSettings.xm

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,34 @@ static void DYYYRemoveRemoteConfigObserver(void) {
9090
if (![accessibilityLabel isEqualToString:@"设置"]) {
9191
return;
9292
}
93-
if (![self viewWithTag:232323]) {
93+
UIView *targetSuperView = self.superview.superview.superview ?: self;
94+
if (![targetSuperView viewWithTag:232323]) {
9495
UIButton *dyyyBtn = [UIButton buttonWithType:UIButtonTypeSystem];
9596
dyyyBtn.tag = 232323;
97+
dyyyBtn.accessibilityLabel = @"DYYYSettingsButton";
9698
[dyyyBtn setTitle:@"DYYY" forState:UIControlStateNormal];
97-
[dyyyBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
99+
100+
UIColor *titleColor;
101+
if (@available(iOS 13.0, *)) {
102+
UIUserInterfaceStyle style = self.traitCollection.userInterfaceStyle;
103+
if (style == UIUserInterfaceStyleDark) {
104+
titleColor = [UIColor whiteColor];
105+
} else {
106+
titleColor = [UIColor blackColor];
107+
}
108+
} else {
109+
titleColor = [UIColor blackColor];
110+
}
111+
[dyyyBtn setTitleColor:titleColor forState:UIControlStateNormal];
112+
98113
dyyyBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
99-
dyyyBtn.frame = CGRectMake(self.bounds.size.width - 60 - 10 - 150, 0, 60, 32);
114+
CGRect frame = self.frame;
115+
dyyyBtn.frame = CGRectMake(frame.origin.x + frame.size.width - 60 - 10 - 2, 8, 60, 32);
100116
dyyyBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
101117
dyyyBtn.layer.cornerRadius = 8;
102118
dyyyBtn.clipsToBounds = YES;
103119
[dyyyBtn addTarget:self action:@selector(dyyyButtonTapped) forControlEvents:UIControlEventTouchUpInside];
104-
[self addSubview:dyyyBtn];
120+
[targetSuperView addSubview:dyyyBtn];
105121
}
106122
}
107123

0 commit comments

Comments
 (0)